Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- can we store the result of dynamic query into a variable and use it in if block?
- Declare
- v_count number
- v_sql varchar2(1000);
- begin
- v_count :='select count(*) from table_name';
- Execute Immediate v_count;
- if(v_count <>0) then
- v_sql :='delete table_name where x=X' ;
- Execute Immediate v_sql ;
- End if ;
- end;
- Declare
- v_statement varchar2(32767);
- v_count number;
- v_sql varchar2(1000);
- begin
- v_statement :='select count(*) from table_name';
- Execute Immediate l_statement into v_count;
- if v_count >0 then
- ...
- end if ;
- end;
Advertisement
Add Comment
Please, Sign In to add comment