Pass single quote as parameter in stored procedure

Database
Enthusiast

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);"

Tags (1)
4 REPLIES
Enthusiast

Re: Pass single quote as parameter in stored procedure

Enthusiast

Re: Pass single quote as parameter in stored procedure

This should work,

If it doesn't can you post your Proc?

 ' O1 varchar(5) (title '' O1 '') , O2 varchar(5) (title ''  O2 '') '

Rglass

Enthusiast

Re: Pass single quote as parameter in stored procedure

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)

 

Enthusiast

Re: Pass single quote as parameter in stored procedure

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