All Forums Database
sujjichalla 8 posts Joined 11/10
12 Sep 2014
Pass single quote as parameter in stored procedure

I'm creating a table in stored procedure which uses 'title' keyword.
Create table t1 ( O1 varchar(5) title ' "O1 " ' , O2 varchar(5) title ' " O2" ');
I have to pass everything inside the brackets as a string i.e. str1= ' O1 varchar(5) title ' "O1 " ' , O2 varchar(5) title ' " O2" ' '
I'm unable to pass str1 as parameter.
Call proc1 (str1);
and proc1 definition should be"create table (str1);"

Raja_KT 1246 posts Joined 07/09
12 Sep 2014

Raja K Thaw
My wiki: http://en.wikipedia.org/wiki/User:Kt_raj1
Street Children suffer not by their fault. We can help them if we want.

Glass 225 posts Joined 04/10
12 Sep 2014

This should work,
If it doesn't can you post your Proc?
 ' O1 varchar(5) (title '' O1 '') , O2 varchar(5) (title ''  O2 '') '
Rglass

sujjichalla 8 posts Joined 11/10
12 Sep 2014

replace procedure proc1 (in oprList varchar(500))
begin
declare ssql1 varchar(1000);
set ssql1=' create table table1 ( ' || oprList || ' );';
execute immediate ssql1;
end
call proc1 (  ' O1 varchar(5) title ' "O1 " ' , O2 varchar(5) title ' " O2" ' ')
 
table columns should look like "O1" and "O2" (with double quotes)
 
 
 
 

12 Sep 2014

Hopefully here is ur solution .......Plz check once
replace procedure proc1 (in oprList varchar(500))
begin
declare ssql1 varchar(1000);
set ssql1=' create table table12 ( ' || oprList || ' );';

CALL DBC.SYSEXECSQL(ssql1);
end;
/

call proc1 (   ' O1 varchar(5) title '' O1 '' , O2 varchar(5) title ''  O2 '' ')
 
 
 
---- Rajjj

You must sign in to leave a comment.