1

I have two tables A,B with lots of columns and a cursor

CURSOR Cur  
IS 
select A.*, B.* FROM A,B

I want to fetch the cursor into a TYPE that stored the rowtype of two tables. However, I do not want to create a TYPE by typing all of the column name of two tables. I tried the following but neither of them work.

--1

RecA                 A%RowType
RecB                 B%RowType
FETCH Cur INTO RecA, RecB

--2

RecA                 A%RowType
RecB                 B%RowType
RecAB                A||B%RowType
FETCH Cur INTO RecAB

P.S. The problem can be solved by using two cursors but I want to know is there a way to concat two rowtype.

1 Answer 1

2

Reading the fine manual:

enter image description here

explicit_cursor_name

Name of an explicit cursor. For every column selected by the query associated with explicit_cursor_name, the record has a field with the same name and data type.

So you can simple say:

type cur_t is cur%rowtype;

Also see the examples.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.