Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Execute Immediate with INTO and Count

505977Sep 29 2006 — edited Sep 29 2006
It's Friday and maybe I can't think straight:

I have the following:

v_sql := 'Select Count(*) From ' || v_stable
|| ' Where object_type_cd=:object_cd'
|| ' and kpi_indicator_type_id=:type_id'
|| ' and security_reference_id=:ref_id';

execute immediate v_sql using 'KPI', v_type_id, v_camid into v_cnt;

if v_cnt > 0 then
<...do something here...>
end if;


v_sql is declared, v_stable is assigned, and my using variables are also assigned.

Should this work so that I can get the count in v_cnt? I'm having a hard time executing a test in TOAD so I'm not sure what I'm doing wrong.

This code is part of a procedure.

Thanks,
Greg
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 27 2006
Added on Sep 29 2006
4 comments
1,066 views