[PL/SQL Question]How can I do this?

From: Ryan Park <bajy_at_intizen.com>
Date: 4 Sep 2001 20:35:02 -0700
Message-ID: <5016f0aa.0109041935.433b15c5_at_posting.google.com>



Hi,

[Quoted] (NOTE: I'm totally a newbie to Pro*C/C++. This is my first 4th day of working on oracle. So if you have any advice to me don't hesitat to reply to this posting. Any words would be grateful. :-) )

See below pseudo-code first.

////

[Quoted] sprintf(l_szCmd, "Select.....where a.pk = '%s'....", input_parameter);

EXEC SQL EXECUTE

DECLARE CMD1 STATEMENT;                
PREPARE CMD1 FROM :l_szCmd;            

DECLARE csFMLY CURSOR FOR CMD1;
DECLARE ttt csFMLY%ROWTYPE;
begin
OPEN csFMLY;
FETCH csFMLY into ttt;
	for a in csFMLY LOOP
		ttt := a;
		dbms_output.put_line(ttt.a);
	END LOOP;

close csFMLY;
end;
end-EXEC;
////

This generates compile errors.

It goes:"
REPARE CMD1 FROM :l_szCmd;

.....................1

PLS-S-00103, Encountered the symbol "FROM" when expecting one of the following:

   := . ( _at_ % ; not null range renames default character

Semantic error at line 243, column 3, file InsaKirok_publish.pc:

                DECLARE CMD1 STATEMENT;

"

What I want to do is selecting..fetching selected data...retrive data to C++ appl and return to client.

And my questions are ..

    [Quoted]
  1. Why I can not use "PREPARE CMD1 FROM :l_szCmd;" (for dynamical sql [Quoted] statement generation ) in EXEC SQL EXECUTE ~ END-EXEC phrase? Why compile errors occur? [Quoted]
  2. If this error can be fixed, how can I do that?
  3. I want to refer the fetched data (in this cod:ttt) in my C++ application.

How can I do that?

[Quoted] 4. I've saw dbms_output() API from other's posting. But this prints nothing to my console. How can I use this?

[Quoted] Plz help. Thank a million.

Regards,
 Ryan Received on Wed Sep 05 2001 - 05:35:02 CEST

Original text of this message