× 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: Re: Embedded SQL
  • From: Rob Berendt <rob@xxxxxxxxx>
  • Date: Wed, 19 May 1999 8:30:03 -0500

The other gent was right on, I just wanted to clear up part of it.  The 
question 
mark is called a 'parameter marker'.  It is matched with a USING clause.

eval string = 'Select A,B,C,D from FILEA whereA=?'
PREPARE STATEMENT FROM STRING
DECLARE c cursor for statement
Open C  USING FLD1:
Fetch into
Close c





sramanujan@sungardfutures.com on 05/18/99 06:31:34 PM
Please respond to MIDRANGE-L@midrange.com@Internet
To:     MIDRANGE-L@midrange.com@Internet
cc:      
Fax to: 
Subject:        Embedded SQL

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
+---


+---
| 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:

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.