sql - Issue with dynamic execute immediate query -
i have code in procedure looks this. when execute code, error mentioned below.
the error report got is:
error report - ora-06553: pls-306: wrong number or types of arguments in call 'ogc_y' ora-06512: @ line 20 06553. 00000 - "pls-%s: %s" *cause:
*action:
the error has primary_flag = "y"
<-- this. how else can write primary_flag = 'y' inside string? dynamic query required in case.
my code is:
declare p_assignee_id number := 10153; time_stamp timestamp := '12-dec-2011'; create_task_view_sql varchar2(4000); begin create_task_view_sql:= 'select unique cp.sub_last_name cs_sr_contact_points_v cp cp.incident_id = 55500 , cp.contact_phone not null , primary_flag = "y"'; dbms_output.put_line(create_task_view_sql); execute immediate create_task_view_sql; end;
to embed quoted string in quoted string, use 2 single quotes:
'...and primary_flag=''y''';
or can use newer q'
syntax avoid doubling embedded quotes:
q'[...and primary_flag='y']';
Comments
Post a Comment