Inclusions, two of the same structure cursor how to merge, and the query again?
The following two inclusions, the inclusions P_T002 call P_T001 with different parameters,
Returns the cursor, two identical structure (in actual use, P_T001 query can be complex)
I want to be in P_T002 combined output will be twice the cursor returned results, how to operate?
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
PROCEDURE P_t001 (P_IP IN varchar2,
P_CUR OUT V_CUR) Is
The Begin
The open p_cur for select p_ip from dual;
End P_t001;
PROCEDURE P_t002 (P_IP IN varchar2,
P_CUR OUT V_CUR) Is
V_cur1 V_CUR;
V_cur2 V_CUR;
The Begin
P_t001 (' 11 ', v_cur1);
P_t001 (' 22 'v_cur2);
P_cur:=v_cur2;
-- -- -- -- -- problem point 1
End P_t002;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Problem of point 1, using p_cur:=v_cur2 way, a cursor can be assigned to completely p_t002 cursor,
But how to combine v_cur1 and v_cur2 both??
Asked the other, if you want to again to back in P_T002 v_cur1 results for second query, want how to do??
CodePudding user response:
Does anyone know?CodePudding user response:
Need not merge, define a nested table or index table, the two cursor values to the same arrayCodePudding user response:
Is this your open by value in the cursor with LOOP asm is???????Feel the cursor line by line to open the assignment very slow, and there is no other way??
CodePudding user response:
In the temporary table, then to traverse the temporary table;CodePudding user response:
The cursor query one-off inserted into a temporary table,That's a good idea,,,
But this one-off insert what to do??
Insert is also using open LOOP asm cursor, asm??????? This is similar to the above methods, and efficiency is very slow,,,