on 01-26-2015 3:18 PM
Hi All,
I have written a sql procedure to truncate a table as below.
create or replace
procedure TRUNCATE_TABLE (TABLE_NAME IN VARCHAR2)
AS
BEGIN
EXECUTE IMMEDIATE ('truncate table ' || TABLE_NAME);
END;
I have imported this procedure in data services. I am trying to execute it in a script as follows.
begin
sql('DS_SEL_PEM_SDB','BODS_ODS_SEL.TRUNCATE_TABLE{''LES_PS_PRODUCT_DATA''}');
end
But I am getting below error
Identifier <LES_PS_PRODUCT_DATA> is unrecognized. Check its spelling and usage. If it is a variable, it needs a preceding
'$'; if a constant, it must be quoted; if a column, verify that such a column exists in a table.
The string is already quoted. Still this error. Anyone has idea how to call procedure with parameter in script?
Hello
If you have imported the metadata for the procedure, you don't need to use the SQL function to invoke it - try dragging it into a script from the Datastore.
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Swati,
please try to use single quotes. You could use single quotes like sql('DS_SEL_PEM_SDB','BODS_ODS_SEL.TRUNCATE_TABLE{\'LES_PS_PRODUCT_DATA\'}');.
Maybe you have to escape the parmeter like (sorry I can not find the job where I have do this)
sql('DS_SEL_PEM_SDB','BODS_ODS_SEL.TRUNCATE_TABLE{\'' || LES_PS_PRODUCT_DATA || '\'}');.
or with $
sql('DS_SEL_PEM_SDB','BODS_ODS_SEL.TRUNCATE_TABLE{\'' || $LES_PS_PRODUCT_DATA || '\'}');.
Regards
Severin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What's the syntax of a procedure call in your database?
If it is
BODS_ODS_SFX.TRUNCATE_TABLE('LVS_PS_PRODUCT_SERVICE')
then your sql-function call should be like:
sql('DS_LVS_GHA_BQ_SDB','BODS_ODS_SFX.TRUNCATE_TABLE(\'LVS_PS_PRODUCT_SERVICE\')');
The only difference is that you've got to escape your single quotes with a backslash.
If you want to use a global variable, no quotes, no escape characters, and curly brackets:
sql('DS_LVS_GHA_BQ_SDB','BODS_ODS_SFX.TRUNCATE_TABLE({$LV_TruncateTableName})');
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.