PL/SQL (MOSC)

MOSC Banner

how to execute dynamic sql in procedure

edited May 15, 2013 2:21AM in PL/SQL (MOSC) 14 commentsAnswered ✓
I need to execute multiple dynamic select statement in procedure and display count on screen. here i wrote the procedure. but not working properly.

create or replace procedure sqlexe (data_value IN varchar2)
IS
stringtext varchar2(1000);
v_data_value varcha2(30);
BEGIN
v_data_value:=data_value;
select 'select 'SELECT count(*) FROM  C' || EC_SERVER_SECURITY_CODE || '.' ||  'V_Platform_Module_Count WHERE DATA_VALUE = '|| '''v_data_value''' || ';' from customer_info'
into stringtext from customer_info;
execute immediate stringtext;
END;

show error

  • Error(7,152): PLS-00103: Encountered the symbol " from customer_info" when expecting one of the following: ( begin case declare end exception exit for goto if loop mod null pragma raise return select update while with

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center