Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 1st, 2005, 07:49 AM
Authorized User
 
Join Date: Sep 2004
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Nitin_sharma Send a message via Yahoo to Nitin_sharma
Default Like statement

Hi Guys,
I am new to oracle coding and I wrote this store procedure

PROCEDURE Get_Faq_Proc
       ( header_name in varchar2,
         out_faq_list OUT curTableList
       )
    IS
    BEGIN
         OPEN out_faq_list for
         select question , answer
         from faq_data
         where header_id = (select header_id from faq_header where title LIKE (''%' || header_name || '%'');

         end Get_Faq_proc;
And it comes up with an oracle error at like statement.
Any help would be appreciated.
Nitin

 
Old February 1st, 2005, 09:13 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

LIKE ('% || header_name || %')

Try that.

 
Old February 1st, 2005, 10:19 AM
Authorized User
 
Join Date: Sep 2004
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Nitin_sharma Send a message via Yahoo to Nitin_sharma
Default

I tried doing this but still my store procedure does not return any data. The code I wrote in asp follows below:

strFAQRequest = LCase(request("section"))
dim faqs
dim dbCmd
set faqs = server.CreateObject("ADODB.RECORDSET")
set dbCmd = Server.CreateObject("ADODB.COMMAND")
Const getfaqs = "{call HMIS_FAQ_Pkg.Get_Faq_Proc(?)}"
dbCmd.ActiveConnection = con
dbCmd.CommandText = getfaqs
dbCmd.CommandType = adCmdText
dbCmd.Parameters(0).direction = adParamInput
dbCmd.Parameters(0).Value = strFAQRequest
set faqs = dbCmd.Execute
dbCmd.Cancel
set dbCmd = nothing

It always comes up with the message that no data is returned from the recordset.I reckon the way i am passing the parameters to the Store Procedure is right??

Cheers,
Nitin

 
Old February 1st, 2005, 10:36 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

What does your data look like?

 
Old February 1st, 2005, 10:42 AM
Authorized User
 
Join Date: Sep 2004
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Nitin_sharma Send a message via Yahoo to Nitin_sharma
Default

The data which I fetch from table are just 2 varchar values.
Its a table of Frequently Asked question with following enteries

ID Number
Header_id Number
Question Varchar2
Answer Varchar2

The header_id is a foriegn key with maps from the table with following attributes

Header_id Number
Title Varchar2

Now from my asp page I am sending the name of this title and then trying to fetch its header_id and get my question and answer recordset.There is no data returned at all on any options I am giving .
Cheers
Nitin

 
Old February 1st, 2005, 10:53 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Will (select header_id from faq_header where title LIKE ('% || header_name || %') return one record or multiple records?

Also try select header_id from faq_header where upper(title) LIKE upper('% || header_name || %')

 
Old February 1st, 2005, 11:03 AM
Authorized User
 
Join Date: Sep 2004
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Nitin_sharma Send a message via Yahoo to Nitin_sharma
Default

The Select statement only returns one record. and its header_id which is the primary key for the table.

 
Old February 1st, 2005, 11:12 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

select question, answer
  from faq_data d, faq_header h
 where d.header_id = h.header_id
   and UPPER(h.title) LIKE UPPER('% || header_name || %');

You can also try this.






Similar Threads
Thread Thread Starter Forum Replies Last Post
if/else statement mussa Beginning PHP 5 July 3rd, 2006 06:06 PM
What does the @ do in the following statement? kenn_rosie VB.NET 2002/2003 Basics 1 March 15th, 2006 12:20 PM
Like Statement Nitin_sharma Oracle ASP 2 May 10th, 2005 12:18 AM
Like Statement Nitin_sharma Oracle 4 February 12th, 2005 01:46 PM
if statement markhardiman VS.NET 2002/2003 1 July 31st, 2003 06:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.