The following code is in the write stored procedure:
For a in ( select a.svo_no,a.audit_no,a.order_id by tt_pi_model_rel a ) LOOP SELECT COUNT (1) into v_ FLAG from tt_pi_order WHERE pi_id in (a.order_id) and regulariza_date are not NULL;//perform several operations end LOOP;
which
SELECT a.svo_no,a.audit_no,a.order_id from Tt_pi_model_rel a order_id has multiple values 1000007845,1000007669
Order_Id put pi_id in (a.order_id) to execute query error
Because of the parameter problem in in, it is not easy to understand that pi_id in (1000007845,1000007669) is a pi_id in (a variable), which results in a query error
Workaround: Advance the
SELECT COUNT (1) into V_flag from Tt_pi_order WHERE pi_id in (a.order_id) and regulariza_date are not NULL;
Stitching into the form of an SQL statement, rather than passing in the form of a.order_id,
The operation is as follows:
Execute IMMEDIATE ' SELECT COUNT (1) From Tt_pi_order WHERE pi_id in ('| | a.order_id| | ' ) and regulariza_date are not NULL 'into C_flag;
Use
Execute IMMEDIATE solve the problem
The usage can refer to network: http://kevinlee0755.iteye.com/blog/1381617
Oracle in pass string parameter query failed