create or replace procedure createTree(
anyChar in varchar
) as
longStrSql varchar(255);
begin
dbms_output.putline(strChar);
longStrSql:='select * from test1 t start with trim(t.name)='||strChar||''connect by prior trim(t.owner)=trim(t.name)';
dbms_output.put_line(longStrSql);
end;
运行
call createTree('el');
发现el 的确传入了但是 当我打印longStrSql时才发现 其中的值为
select * from test1 t start with trim(t.name)='||strChar||'connect by prior trim(t.owner)=trim(t.name)
那位赐教一下 谢谢
anyChar in varchar
) as
longStrSql varchar(255);
begin
dbms_output.putline(strChar);
longStrSql:='select * from test1 t start with trim(t.name)='||strChar||''connect by prior trim(t.owner)=trim(t.name)';
dbms_output.put_line(longStrSql);
end;
运行
call createTree('el');
发现el 的确传入了但是 当我打印longStrSql时才发现 其中的值为
select * from test1 t start with trim(t.name)='||strChar||'connect by prior trim(t.owner)=trim(t.name)
那位赐教一下 谢谢
strChar in varchar
) as
longStrSql varchar(255);
begin
dbms_output.put_line(strChar); -- 是put_line
longStrSql:='select * from test1 t start with trim(t.name)=''' --两个单引号算一个
||strChar||'''connect by prior trim(t.owner)=trim(t.name)';
dbms_output.put_line(longStrSql);
end;
EXEC createTree('el');39 PL/SQL block, executed in 0 sec.
el
select * from test1 t start with trim(t.name)='el'connect by prior trim(t.owner)=trim(t.name)
Total execution time 0.015 sec.
create or replace procedure createTree(
strChar in varchar
) as
longStrSql varchar(255);
begin
dbms_output.put_line(strChar); -- 是put_line
longStrSql:='select * from test1 t start with trim(t.name)=''' --两个单引号算一个
||strChar||''' connect by prior trim(t.owner)=trim(t.name)'; --connect by 前空一格
dbms_output.put_line(longStrSql);
end;