Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 14 total
Thread Stored proc: parameter problem
Sat, Feb 23 2008 6:14 AMPermanent Link

Felix
Hi,

I created this simple stored proc:

BEGIN
DECLARE Result CURSOR WITH RETURN FOR Stmt;
  BEGIN
  PREPARE Stmt FROM 'SELECT * from MyTable where UserID = ?';
  OPEN Result;
  END;
END

Also I created a parameter "UserID". When executing the proc the result are 0 records.
When I replace the param by a constant it works fine.
Tested this in ElevateDB Manager.

What am I doing wrong?

Felix
Sat, Feb 23 2008 10:13 AMPermanent Link

"Harry de Boer"
Felix,

Replace:  OPEN Result; with: OPEN Result USING UserID;

Regards, Harry

"Felix" <test@test.com> schreef in bericht
news:4E8222C2-EF28-48C3-93B5-A72BE5820E87@news.elevatesoft.com...
> Hi,
>
> I created this simple stored proc:
>
> BEGIN
> DECLARE Result CURSOR WITH RETURN FOR Stmt;
>    BEGIN
>    PREPARE Stmt FROM 'SELECT * from MyTable where UserID = ?';
>    OPEN Result;
>    END;
> END
>
> Also I created a parameter "UserID". When executing the proc the result
are 0 records.
> When I replace the param by a constant it works fine.
> Tested this in ElevateDB Manager.
>
> What am I doing wrong?
>
> Felix
>

Sat, Feb 23 2008 10:40 AMPermanent Link

Felix
"Harry de Boer" <harry@staaf.nl> wrote:

Replace:  OPEN Result; with: OPEN Result USING UserID;

Thank you, Harry. Any idea where to find that in a manual or help-file just to understand it?

Regards Felix
Sat, Feb 23 2008 2:09 PMPermanent Link

Felix
"Harry de Boer" <harry@staaf.nl> wrote:

Replace:  OPEN Result; with: OPEN Result USING UserID;

No need to answer: this seems to be general SQL stuff. I'll get the information from a
good book Smile

Thanks. Felix
Sat, Feb 23 2008 4:12 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Felix,

<< No need to answer: this seems to be general SQL stuff. I'll get the
information from a good book Smile>>

Just a quick note - the dynamic SQL used in the SQL/PSM implementation in
ElevateDB is non-standard for stored procedures, but it is standard dynamic
SQL syntax for client-side dynamic SQL.  So, to get information about
PREPARE, UNPREPARE, EXECUTE, and EXECUTE IMMEDIATE, you'll need to consult
the Dynamic SQL section of any good SQL book.  For example, in Jim Melton's
excellent SQL1999 book, these statements are covered in Chapter 18 - Dynamic
SQL.

Some implementations of dynamic SQL in stored procedures has used completely
funky and vendor-specific syntax (Oracle, for example).   I thought it best
that if we're going to use dynamic SQL in the stored procedures, that it at
least be standard dynamic SQL syntax. Smiley

--
Tim Young
Elevate Software
www.elevatesoft.com

Sun, Feb 24 2008 8:52 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim


I know you've recommended this book before so I just had a look on Amazon - the price ranged from £20 (used) - £150 (new). I might buy the used one Smiley

Roy Lambert
Sun, Feb 24 2008 9:39 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Roy,

Following Tim's recommendation I ordered a new one at Amazon.co.uk about
2 months ago and I'm still waiting... I'm afraid the book will be
outdated when I finally receive it Smiley

--
Fernando Dias


Roy Lambert escreveu:
> Tim
>
> I know you've recommended this book before so I just had a look on Amazon - the price ranged from £20 (used) - £150 (new). I might buy the used one Smiley
>
> Roy Lambert
Sun, Feb 24 2008 11:24 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Fernando


How come you're ordering from the UK site?

Roy Lambert
Sun, Feb 24 2008 7:13 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Roy

Well, inside EU the choices are UK, France and Germany.
Since my French is even worst then my English and I don't understand
German at all, I chose UK. Also, I thought it would be faster then
ordering from US.

--
Fernando Dias
Sun, Feb 24 2008 7:44 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

I'm starting to think learning German would be easier Smiley
I meant "worst than my English" and "faster than ordering".
Sorry.

> Well, inside EU the choices are UK, France and Germany.
> Since my French is even worst then my English and I don't understand
> German at all, I chose UK. Also, I thought it would be faster then
> ordering from US.
Page 1 of 2Next Page »
Jump to Page:  1 2
Image