pl/sql table [message #656607] |
Wed, 12 October 2016 10:55 |
|
SamMen
Messages: 4 Registered: October 2016
|
Junior Member |
|
|
Hi,
Is there any way I can add data into pl/sql table manually?
TYPE dept_table_tab_RECORD IS RECORD (
DEPTNO DEPT1.deptno%TYPE,
DNAME DEPT1.DNAME%TYPE,
LOC DEPT1.LOC%TYPE
);
TYPE dept_table_tab2 IS TABLE OF dept_table_tab_RECORD; -- NESTED TABLES CREATED OF A RECORD TYPE CREATED
ldata2 dept_table_tab2;
begin
SELECT deptno,dname,loc
BULK COLLECT INTO ldata1
FROM dept1; -- ASSIGN VALUES DIRECTLY NESTED TABLES CREATED DIRECTLY AS AN EXISTING OBJECT
--I want to do something like:
insert into ldata1
select '10','Dept no 10','TX' from dual;
end;
|
|
|
Re: pl/sql table [message #656608 is a reply to message #656607] |
Wed, 12 October 2016 11:02 |
John Watson
Messages: 8938 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
There is the syntax
INSERT INTO TABLE ( collection_expression )
where the collection can be a varray. Is that any good to you?
|
|
|
|
|
Re: pl/sql table [message #656614 is a reply to message #656611] |
Wed, 12 October 2016 13:01 |
John Watson
Messages: 8938 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Quote:I have just shifted from the sql server world to Oracle..
Back there, they had #temp tables, which can be used as permanent tables in session (inserts, updates, deletes, selects etc)
I was searching for an equivalent of that in Oracle. Don't do it, man! Just use subqueries. In the Oracle environment, using any sort of temporary storage is almost always a program design error with bad implications for performance and and use of resources. Trust Uncle Oracle to take of it for you.
|
|
|