How to set the SQL for TOraStoredProc where SQL is multiline plsql call block

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
u203379
Posts: 2
Joined: Tue 28 Jan 2020 14:12

How to set the SQL for TOraStoredProc where SQL is multiline plsql call block

Post by u203379 » Tue 28 Jan 2020 14:17

How to set the SQL for TOraStoredProc where SQL is multiline plsql call block

Dear Forum
Can anyone tell me how to the set the SQL for TOraStoredProc
I was able to set the value for StoredProcName relatively easily .. but I am not sure how to approach the SQL
I can get the value of the SQL from the properties, but not sure how to set it.
Can anyone offer advice?
Many thanks
Regards
Adrian

Using this I can see values
writeLn(OraStoredProc_SetRole.StoredProcName);
writeLn(OraStoredProc_SetRole.SQL.Text);

I want to set the SQL to something like the following programmatically

begin
SECAPPADMIN.TOPORAIL_VARI_PRIVS_PKG.SET_ROLE(:P_KEY, :P_PERMISSION);
end;

or

declare
v_IN_FOR_CHANGE boolean := sys.DIUTIL.INT_TO_BOOL(:IN_FOR_CHANGE);
v_IN_GANZE_CH boolean := sys.DIUTIL.INT_TO_BOOL(:IN_GANZE_CH);
v_OUT_STATUS boolean;
begin
geomatik.gss_EXPORT_PCK.EXPORT_GSS(:IN_GSS_KEY, :IN_USERID, :IN_SPRACHE, v_IN_FOR_CHANGE, v_IN_GANZE_CH, :IN_Y_ECKE1, :IN_X_ECKE1, :IN_Y_ECKE2, :IN_X_ECKE2, v_OUT_STATUS, :OUT_FEEDBACK);
:OUT_STATUS := sys.DIUTIL.BOOL_TO_INT(v_OUT_STATUS);
end;

u203379
Posts: 2
Joined: Tue 28 Jan 2020 14:12

Re: How to set the SQL for TOraStoredProc where SQL is multiline plsql call block

Post by u203379 » Tue 28 Jan 2020 14:46

Found the solution - See https://www.devart.com/odac/docs/pl_sql_torasql.htm
Not the neatest of code but should work for my purposes
Regards

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: How to set the SQL for TOraStoredProc where SQL is multiline plsql call block

Post by MaximG » Fri 31 Jan 2020 16:04

Yes, to execute SQL statements with multiline plsql call block, you can use TOraSQL Class. TOraStoredProc is a component for working with a specific stored procedure in Oracle, which name you can set in the property OraStoredProc.StoredProcName.

Post Reply