Home » SQL & PL/SQL » SQL & PL/SQL » Dynamic Select with parameters
Dynamic Select with parameters [message #36372] Thu, 22 November 2001 01:58 Go to next message
Mac78
Messages: 1
Registered: November 2001
Junior Member
Hi to all people.
My english is not very well, because I am from Italy

Well.
My problem is this:
I need to perform a query in a table, but
I want a result from a specific table and a specific
field. How can I use any parameters to do this?
I would to use your script into a stored procedure.

Thank you very much.
Bye

P.s. IT's TOO URGENT!

----------------------------------------------------------------------
Re: Dynamic Select with parameters [message #36375 is a reply to message #36372] Thu, 22 November 2001 03:45 Go to previous message
Nicola Farina
Messages: 63
Registered: October 2001
Member
Hi Mac78

Have a look at the DBMS_SQL package.
See an example of use below:

CurHandle integer;
..
CurHandle := DBMS_SQL.OPEN_CURSOR;

DBMS_SQL.PARSE(CurHandle,
'DELETE FROM ' || cTempTableName ||
' WHERE CD_CATEGORIA = :CategoriaRichiesta ' ||
' AND ID_RAGGRUPPAMENTO = :IdRaggruppamento ',
DBMS_SQL.V7);
DBMS_SQL.BIND_VARIABLE(CurHandle, ':IdRaggruppamento', IdRaggruppamento);
DBMS_SQL.BIND_VARIABLE(CurHandle, ':CategoriaRichiesta', CategoriaRichiesta);
Result := DBMS_SQL.EXECUTE(CurHandle);

----------------------------------------------------------------------
Previous Topic: string to recordtype conversion
Next Topic: problem with a simple PL/SQL Procedure
Goto Forum:
  


Current Time: Fri Nov 22 22:35:41 CST 2024