× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Embedded SQL
  • From: "Sudha Ramanujan" <sramanujan@xxxxxxxxxxxxxxxxxx>
  • Date: Tue, 18 May 1999 17:56:16 -0500
  • Importance: Normal
  • In-Reply-To: <"DALEXCH01-990517225424Z-87359*/PRMD=PSC/ADMD= MCI/C=US/"@MHS>

Hi all,

I was trying to get my Dynamic SQL to work now after a long time and
encountering some problems.  Here is how it is.

I am just querrying a file on the basis of the input from the user. There
are 4 inputs on the screen, say Fld1, Fld2,Fld3,Fld4.  Once I exfmt and get
the user input, I am show them a browse window for matching records.  So if
user does not input any field, I will show entire file.
I have declared a string where I feed in the values. If Fld1 is input, I
will show matching records for Fld1.

                eval string = 'SELECT A, B, C, D FROM FILEA WHERE A=:FLD1'

If Fld1 & Fld2 is input, I show matching records for Fld1 & 2

                eval string = 'SELECT A, B, C, D FROM FILEA WHERE A=:FLD1 and 
B=:Fld2'

and so on...

I then do

PREPARE STATEMENT FROM STRING
DECLARE c cursor for statement
Open C
Fetch into
Close c

In the first prepare statement itself, I am getting an error saying the Fld1
not defined in the table!  If I hard code the string in the cursor like :

        Declare C cursor for select a,b,c,d, from filea where a=:fld1 and 
b=:fld2,

it works perfectly.  But this does not serve my purpose as I cannot declare
more than once in a program.

Could you please tell me where I am going wrong.

Thanks,
Sudha

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.