Pl/sql table - row type records
Hi,
Is there any limit on the number of records that a pl/sql table (row type) can accomodate.Iam using oracle 10g
user11200499 wrote:
I have gone thru that url, nothing on the maximum number of records that can be present in pl/sql table is given there. Will be very helpful if you can let me know if there is any such limitation.There is no such thing as a PL/SQL "+table+". A table, in Oracle terminology, means colums and rows and indexes and the ability to scale data, effectively read and process and filter and aggregate data.
A so-called PL/SQL "+table+" is nothing at all like this.
The correct term for it, and used in all other programming languages, are arrays (procedural term) and collections (object orientated term).
An array/collection is a local memory structure in the unit of code. In PL/SQL, that means PGA (process global area) memory. And as this uses server memory, you should not abuse it and only use as much that is truly needed.
Make a PL/SQL array/collection too large, and PGA grows.. and can have a very negative impact on performance. It can even cause the server to crawl to halt, where you will struggle to enter a commandline command on the server as it is spending 99% of CPU time trying to deal with memory requests and page swapping.
So what do we then use arrays/collections for in PL/SQL?
For the very same reason we use in any other programming language - dealing with managing local programming data in a more effective memory structure. Such as bulk processing when requiring a buffer variable that can be passed to and from the PL and SQL engines.
This does NOT mean using it as you would use it as if it is a SQL table. As it is not.
So to answer your question of how large a PL/SQL array or collection can be? That depends entirely on the problem you are trying to solve. If it is for example bulk processing, then typically a collection of a 100 rows provides the best balance between the amount of (expensive) PGA memory being used versus the increase in performance by reducing context switching between the PL and SQL engines.
If the rows are quite small, perhaps even a 1,000 row collection. More than that seldom decreases context switching enough to justify the increase in expensive PGA.
So what should then be used to store larger data structures in PL/SQL? GTT or Global Temporary Tables. As this is a proper SQL table structure. Can be indexed. Natively supports SQL. Can scale with data volumes.
And most importantly, it does not consume dedicated process memory and will not blow server memory.
Similar Messages
-
Reg: PLS-00418: array bind type must match PL/SQL table row type error
I am trying to access a table of records through JDBC OracleCallableStatement. I am able to do it fine for all mappings except for the ones below
TYPE CAT_CD_TYPE IS TABLE OF A.B %TYPE INDEX BY BINARY_INTEGER;
TYPE ORG_CD_TYPE IS TABLE OF C.D %TYPE INDEX BY BINARY_INTEGER;
Column B is CHAR(1) and Column D is CHAR(2). I am trying to register the out parameters of Oraclecallablestatement as
cstmt.registerIndexTableOutParameter(2, 2000, OracleTypes.CHAR, 0);
cstmt.registerIndexTableOutParameter(3, 2000, OracleTypes.CHAR, 0);
All the other mappings work fine. These two fail with the error
SQLException in invokeDBPackage() : ORA-06550: line 1, column 32:
PLS-00418: array bind type must match PL/SQL table row type
ORA-06550: line 1, column 35:
PLS-00418: array bind type must match PL/SQL table row type
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
I tried other OracleTypes mappings too but no luck so far.
Any advice on this would be greatly appreciated.Hi,
I'm not sure it's reasonable to expect someone to sift through that much stuff.
Which parameter is it having a problem with?
Can you modify the following to reproduce the behavior?
Thanks
Greg
create package mypack5 as
TYPE v2array is table of emp.ename%type index by BINARY_INTEGER;
PROCEDURE test_it(thearray IN v2array, numrecs out number);
END;
CREATE or replace PACKAGE BODY MYPACK5 AS
PROCEDURE test_it(thearray IN v2array, numrecs out number)
IS
begin
numrecs := thearray.count;
END;
END;
using System;
using System.Data;
using Oracle.DataAccess.Client;
public class indexby
public static void Main()
OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger;");
con.Open();
OracleCommand cmd = new OracleCommand("mypack5.test_it", con);
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter Param1 = cmd.Parameters.Add("param1", OracleDbType.Varchar2);
Param1.Direction = ParameterDirection.Input;
Param1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
Param1.Size = 3;
string[] vals = { "foo", "bar", "baz" };
Param1.Value = vals;
OracleParameter Param2 = cmd.Parameters.Add("param2", OracleDbType.Int32, DBNull.Value, ParameterDirection.Output);
cmd.ExecuteNonQuery();
Console.WriteLine("{0} records passed in", Param2.Value);
con.Close();
} -
PLS-00418: array bind type must match PL/SQL table row type
If a PL/SQL table is indexed by CHAR and is a parameter
in a Stored Program, we are not able to call the stored
program from the Java code.
We get the following error code.
java.sql.SQLException: ORA-06550: line 1, column 62:
PLS-00418: array bind type must match PL/SQL table row type
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
But if we change the CHAR into VARCHAR2 then it works.
We are using Oracle9i Enterprise Edition Release 9.2.0.5.0 -64bit Production ,
JServer Release 9.2.0.5.0 - Production
and JDK1.4.
Thanks
Push..Hi,
I'm not sure it's reasonable to expect someone to sift through that much stuff.
Which parameter is it having a problem with?
Can you modify the following to reproduce the behavior?
Thanks
Greg
create package mypack5 as
TYPE v2array is table of emp.ename%type index by BINARY_INTEGER;
PROCEDURE test_it(thearray IN v2array, numrecs out number);
END;
CREATE or replace PACKAGE BODY MYPACK5 AS
PROCEDURE test_it(thearray IN v2array, numrecs out number)
IS
begin
numrecs := thearray.count;
END;
END;
using System;
using System.Data;
using Oracle.DataAccess.Client;
public class indexby
public static void Main()
OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger;");
con.Open();
OracleCommand cmd = new OracleCommand("mypack5.test_it", con);
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter Param1 = cmd.Parameters.Add("param1", OracleDbType.Varchar2);
Param1.Direction = ParameterDirection.Input;
Param1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
Param1.Size = 3;
string[] vals = { "foo", "bar", "baz" };
Param1.Value = vals;
OracleParameter Param2 = cmd.Parameters.Add("param2", OracleDbType.Int32, DBNull.Value, ParameterDirection.Output);
cmd.ExecuteNonQuery();
Console.WriteLine("{0} records passed in", Param2.Value);
con.Close();
} -
Can a PL/SQL table Object Type be used in a VO?
Hi,
Is it possible to use a PL/SQL table object type to provide data to a View Object? In short, I would like to be able to do something like this:
1. Create record object:
CREATE OR REPLACE TYPE xx_rec_type AS OBJECT
(xxid NUMBER,
xxdesc varchar2(10),
xxcost number...);
2. Create table object:
CREATE OR REPLACE TYPE xx_tbl_type AS TABLE OF xx_rec_type;
3. Declare and populate the object in PL/SQL package:
xx_tbl xx_tbl_type;
xx_tbl(i).xxid := 1;
xx_tbl(i).xxdesc := 'XXX';
xx_tbl(i).xxcost := 10.00;
4. Create a View Object as:
SELECT * FROM xx_tbl
Is it even possible to access xx_tbl from View Object? If anyone has done something like this, please do share.
TIA
AlkaA PL/SQL procedure can exist in Oracle DB, in TimesTen, or in both. You control that by where you create the procedure. Procedures that exist in Oracle can really only be called in Oracle and can only access data in Oracle. Procedures that exist in TimesTen can only be called in TimesTen and can only access data in TimesTen. There is a limited capability, using the TimesTen PassThrough capability to call PL/SQL procedures located in Oracle, from Timesten, and for Timesten PL/SQL procedures to access data in Oracle. Using PassThrough does have some overhead.
Chris -
Problem with pl/sql table data type
hai friends,
i have one procedure it has some in parameters and one out parameter which fetches values to front end.
But the out parameter will be pl/sql table data type.
if it is ref cursor
then i declared as
var x refcursor;
exec procedure_name(1,:x);
it is ok.
but for pl/sql table data type is out parameter then what i will do in the prompt .
give me syntax and clarify my doubt.
advanced thanks...
madhavaThe SQL*Plus VARIABLE statement does not support user-defined types, hence it cannot support nested tables. It can support cursors because they can be weakly typed (so we can use the one SQL*Plus VAR to hold any shape of resultset). Nested tables are strongly typed; SQL*Plus is a relatively stupid interface and cannot be expected to understand UDT.
So, it you want to use nested tables as output you'll need to code a wrapping procedure that can understand your nested table type and handle it accordingly.
Sorry.
Cheers, APC -
How create a record type and a pl/sql table of that record type in database
Hi
I want to create a record type and then I want to create a PL/SQL table in the oracle 9i database.
I have done it in PL/SQL block.
But when I am trying to do it in database it is throwing me some error.
Could you please tell me how can I do that?
Regardsuser576726 wrote:
Hi
I want to create a record type and then I want to create a PL/SQL table in the oracle 9i database.
I have done it in PL/SQL block.
But when I am trying to do it in database it is throwing me some error.
Could you please tell me how can I do that?
RegardsRECORD type is supported only in PL/SQL for SQL you need to use OBJECT type. -
How to integrate SQL table with the cahce
Hi,
In normal ASP.net application we use the
sqlCacheDependency to integrate the SQL server with the cache in ASP.NET, so that any change in the SQL table row will replace the cache with the latest data.
How to achieve the same in the Azure cache.
We need to integrate the SQL server with the Azure cache so that any change in the SQL table row should replace the cache with the latest data.Hi,
Cache in Azure is not different with ASP.NET, please see
http://msdn.microsoft.com/en-us/library/windowsazure/gg278356.aspx for more details, Azure provides for multiple types of persistent storage which can be leveraged for caching (Azure SQL Database, Azure Table Storage, Azure Blob Storage etc…). I would suggest
you read this article (http://www.dnnsoftware.com/blog/cid/425642/Understanding-Windows-Azure-Caching-for-building-high-performance-Websites
), because of we know where the cache data is, so we can sync up the data as expected.
Best Regards
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Hi all,
I have populated an index_by binary_integer pl/sql table :
declare
type rec_ty is record(ligne number,code_enreg number(2),code_enreg_ordered number(2));
type tab_ty is table of rec_ty index by binary_integer;
vtab tab_ty;
i pls_integer := 1;
begin
for venreg in(select * from fichier_tempo where num > 0 order by num) loop
vtab(i).ligne := venreg.num;
vtab(i).code_enreg := to_number(substr(venreg.texte,7,2));
i := i + 1;
end loop;
end;
Now I want to sort the code_enreg data of vtab into its code_enreg_ordered field. I must do that because I must verify that each code_enreg data entered are ordered. So if code_enreg is not equal to code_enreg_ordered at a specified index of vtab then I must take a decision in my program code ; I must code something when this disorder happens.
How to do that ?
Thank you very much indeed.Thank you Jeneesh , it works with a few modifications about the assignement of the pl/sql tables.
Fantasy > Your blog talks about sorting the pl/sql table through the key. But I want to sort it through the field data. And my field data contains duplicated data. So you did not really reply to my need. Thank you anymore. -
How to retrieve the values from PL/SQL table types.
Hi Every one,
I have the following procedure:
DECLARE
TYPE t1 IS TABLE OF emp%ROWTYPE
INDEX BY BINARY_INTEGER;
t t1;
BEGIN
SELECT *
BULK COLLECT INTO t
FROM emp;
END;
This procedure works perfectly fine to store the rows of employee in a table type. I am not able to retrieve the values from Pl/SQL table and display it using dbms_output.put_line command.
Can anybody help me please!!!!!
Thanks
Ahmed.You mean, you can't add this
for i in t.first..t.last loop
dbms_output.put_line(t(i).empno||' '||t(i).ename||' '||t(i).job);
end loop;or you can't add this
set serveroutput onor maybe, you are working in third party application where dbms_output is not applicable at all?
You see, not able like very similar it is not working - both are too vague...
Best regards
Maxim -
Passing parameters to PL/SQL table types
Hi Everybody,
I have one question about passing PL/SQL tables types and tabs as IN parameter in procedure.I am working in 11.2.0.2.0 environment. I am stuck on how to pass those values to procedure.Please find below more details:
Table 1:
CREATE TABLE ITEMS
ITEM_ID VARCHAR2(40 BYTE) NOT NULL,
ITEM_NAME VARCHAR2(40 BYTE),
SERIAL NUMBER(2),
ADDED_ON DATE);
Table 2:
CREATE TABLE ITEM_ACTIVITY_INFO
ITEM_ID VARCHAR2(40 BYTE) NOT NULL,
ACCOUNT_TYPE VARCHAR2(1 BYTE),
ID_NUMBER NUMBER(3),
ACTIVATION_DATE DATE);
Table 3:
CREATE TABLE ITEM_GROUP
GROUP_ID NUMBER(2) NOT NULL,
ITEM_ID VARCHAR2(40 BYTE),
GROUP_TYPE VARCHAR2(20 BYTE),
GROUP_DATE DATE);
Table 4:
CREATE TABLE ITEM_ADDRESS
GROUP_ID NUMBER(2) NOT NULL,
NAME VARCHAR2(60 BYTE),
ADDRESS VARCHAR2(100));
Following types are created:
CREATE OR REPLACE TYPE ITEMS_TYPE AS OBJECT
ITEM_ID VARCHAR2(40 BYTE),
ITEM_NAME VARCHAR2(40 BYTE),
SERIAL NUMBER(2),
ADDED_ON DATE);
CREATE OR REPLACE TYPE ITEM_ACTIVITY_TYPE AS OBJECT
ITEM_ID VARCHAR2(40 BYTE),
ACCOUNT_TYPE VARCHAR2(1 BYTE),
ID_NUMBER NUMBER(3),
ACTIVATION_DATE DATE);
CREATE OR REPLACE TYPE ITEM_GROUP_COMP_TYPE AS OBJECT
GROUP_ID NUMBER(2) NOT NULL,
ITEM_ID VARCHAR2(40 BYTE),
GROUP_TYPE VARCHAR2(20 BYTE),
GROUP_DATE DATE
ITEM_ADDRESS_IN ITEM_ADDRESS_TYPE);
CREATE OR REPLACE TYPE ITEM_ADDRESS_TYPE AS OBJECT
GROUP_ID NUMBER(2),
NAME VARCHAR2(60 BYTE),
ADDRESS VARCHAR2(100));
CREATE OR REPLACE TYPE ITEM_GROUP_COMP_TAB AS TABLE OF ITEM_GROUP_COMP_TYPE;
Create or replace procedure ITEM_ADD_CHANGE(
ITEM_IN IN ITEMS_TYPE,
ITEM_ACTIVITY_IN IN ITEM_ACTIVITY_TYPE,
ITEM_GROUP_IN IN ITEM_GROUP_COMP_TAB,
ITEM_OUT IN OUT ITEMS.ITEM_ID%TYPE);
Above are the paramteres we are passing to procedure.
I need help in how to pass parameters to above procedure. All comments and responses will be highly appreciated. Thanks everyone for going through the post. Please let me know if more more information is required on this problem.
Regards
DevBilly Verreynne wrote:
Types used in this fashion, only make sense if the table is based on the type. It makes very little sense to have a table structure and then to duplicate the structure using a type.
The 2 structures may be defined the same. But they are NOT interchangeable and requires one to be converted to the other to use. This is not sensible in my view. It is far easier in that case to simply use the PL/SQL macro +%RowType+ to create a duplicate structure definition - one that can natively be used for touching that table, without conversions required.
If you do want to use types, define the type, then define the table of that type, adding the required constraints (pk, fk, not null, check) to the table's definition.Billy:
Just curious, why do you say it makes very little sense to have a type modeled on a table? I do that a lot. In my case, I am getting the values from an external program, not building them manually, but it makes a lot of sense to me.
One application where I do this a lot has a java front-end that parses HL7 messages. Each message contains at least minimal information about a variable number of entities (and often several rows for an entity) in the database, and must be processed as a single atomic trasnaction. So, rather than have potentially hundreds of parameters to the "main" driver procedures for different message types I created a set of types more or less identical to the tables representing the entities. The java program parses the mesasge and populates the type, then calls the appropriate stored procedure for the message type passing in the populated types. My stored procedure then does inserts/updates or deletes as appropriate over potentially dozens of tables.
John -
Inserting rows in PL/SQl table
Hi,
I have a PL/SQl table which i populated through bulk collect and now i am trying to loop through the table (actually quite a few nested loops) ... Now inside one of my loops i might need to insert a new row by splitting field in the existing row in the table. Can I insert the row in the pl/sql table within the loop without affecting the 'FOR i IN tab.first..tab.last' loop ??
Also what would be the index of such a row inserted in the table. Can I access it with tab.last+1 (doesnt look like it can be done if i insert in the various levels of loops).
OR
If I insert the rows insde the nested loops , then I can access the new rows once I close all the loops and open a fresh loop ??. Will the new rows be at the last of the table.
Any help will be appreciated ...user2309906 wrote:
Hi,
I have a PL/SQl table which i populated through bulk collect and now i am trying to loop through the table (actually quite a few nested loops) ... Now inside one of my loops i might need to insert a new row by splitting field in the existing row in the table. Can I insert the row in the pl/sql table within the loop without affecting the 'FOR i IN tab.first..tab.last' loop ??
Also what would be the index of such a row inserted in the table. Can I access it with tab.last+1 (doesnt look like it can be done if i insert in the various levels of loops).
OR
If I insert the rows insde the nested loops , then I can access the new rows once I close all the loops and open a fresh loop ??. Will the new rows be at the last of the table.
Any help will be appreciated ...With an associative array:
SQL> ed
Wrote file afiedt.buf
1 declare
2 type t_arr is table of varchar2(10) index by pls_integer;
3 v_arr t_arr;
4 v_cnt number := 0;
5 begin
6 -- populate the associative array
7 for i in (select ename from emp)
8 loop
9 v_cnt := v_cnt + 1;
10 dbms_output.put_line('Populating: '||i.ename);
11 v_arr(v_cnt) := i.ename;
12 end loop;
13 -- now process the associative array
14 for i in v_arr.first .. v_arr.last
15 loop
16 dbms_output.put_line('Processing: '||i||':'||v_arr(i));
17 if v_arr(i) IN ('KING','TURNER','JAMES') then
18 v_arr(v_arr.last+1) := v_arr(i)||to_char(i);
19 dbms_output.put_line('Added: '||v_arr.last||':'||v_arr(i));
20 end if;
21 end loop;
22 -- now what's in the associative array?
23 for i in v_arr.first .. v_arr.last
24 loop
25 dbms_output.put_line('Result: '||i||':'||v_arr(i));
26 end loop;
27* end;
SQL> /
Populating: SMITH
Populating: ALLEN
Populating: WARD
Populating: JONES
Populating: MARTIN
Populating: BLAKE
Populating: CLARK
Populating: SCOTT
Populating: KING
Populating: TURNER
Populating: ADAMS
Populating: JAMES
Populating: FORD
Populating: MILLER
Processing: 1:SMITH
Processing: 2:ALLEN
Processing: 3:WARD
Processing: 4:JONES
Processing: 5:MARTIN
Processing: 6:BLAKE
Processing: 7:CLARK
Processing: 8:SCOTT
Processing: 9:KING
Added: 15:KING
Processing: 10:TURNER
Added: 16:TURNER
Processing: 11:ADAMS
Processing: 12:JAMES
Added: 17:JAMES
Processing: 13:FORD
Processing: 14:MILLER
Processing: 15:KING9
Processing: 16:TURNER10
Processing: 17:JAMES12
Result: 1:SMITH
Result: 2:ALLEN
Result: 3:WARD
Result: 4:JONES
Result: 5:MARTIN
Result: 6:BLAKE
Result: 7:CLARK
Result: 8:SCOTT
Result: 9:KING
Result: 10:TURNER
Result: 11:ADAMS
Result: 12:JAMES
Result: 13:FORD
Result: 14:MILLER
Result: 15:KING9
Result: 16:TURNER10
Result: 17:JAMES12
PL/SQL procedure successfully completed.With standard array (PL/SQL table):
SQL> ed
Wrote file afiedt.buf
1 declare
2 type t_arr is table of varchar2(10);
3 v_arr t_arr;
4 v_cnt number := 0;
5 begin
6 -- populate the pl/sql table
7 select ename bulk collect into v_arr from emp;
8 -- now process the pl/sql table
9 for i in v_arr.first .. v_arr.last
10 loop
11 dbms_output.put_line('Processing: '||i||':'||v_arr(i));
12 if v_arr(i) = 'KING' then
13 v_arr.extend;
14 v_arr(v_arr.last) := 'PRESIDENT';
15 end if;
16 end loop;
17 -- now what's in the pl/sql table?
18 for i in v_arr.first .. v_arr.last
19 loop
20 dbms_output.put_line('Result: '||i||':'||v_arr(i));
21 end loop;
22* end;
SQL> /
Processing: 1:SMITH
Processing: 2:ALLEN
Processing: 3:WARD
Processing: 4:JONES
Processing: 5:MARTIN
Processing: 6:BLAKE
Processing: 7:CLARK
Processing: 8:SCOTT
Processing: 9:KING
Processing: 10:TURNER
Processing: 11:ADAMS
Processing: 12:JAMES
Processing: 13:FORD
Processing: 14:MILLER
Processing: 15:PRESIDENT
Result: 1:SMITH
Result: 2:ALLEN
Result: 3:WARD
Result: 4:JONES
Result: 5:MARTIN
Result: 6:BLAKE
Result: 7:CLARK
Result: 8:SCOTT
Result: 9:KING
Result: 10:TURNER
Result: 11:ADAMS
Result: 12:JAMES
Result: 13:FORD
Result: 14:MILLER
Result: 15:PRESIDENT
PL/SQL procedure successfully completed.
SQL>So, in answer to your questions...
Inserting additional rows in the array during the loop will effect the "last" value and alter the array. If you need to avoid this effect, store the "last" value in a variable and loop up to that value of the variable.
New rows will generally be additional rows on the end of the array unless you are using associative arrays which will then depend on how you reference the rows in the array. -
Auto create request by reading a row in MS SQL table?
Auto create request by reading a row in MS SQL table?
If all required data for a particular request type were included in a row of a MS SQL db table (staging table), could a request be created using a db adaptor? Or is web services the only option to auto create a request?By definition, a DB adapter is part of ServiceLink and ServiceLink handles task-level integration, ie, it can externalize a task that's in a request that already exists. Web Services is the only option to create a new request.
-
Passing PL/SQL table type as IN Parameter to DB Adapter
Hi,
I have an requirement to pass multiple record values(array of values) to an API from BPEL process.
For this,
1) I have created a package procedure having PL/SQL table type variable as IN Parameter.
2) In the BPEL process, created a DB adpater pointing to the above API.(Created wrapper API impicitly)
When I intiated the BPEL process passing multiple values, the API is taking only the first value, ignoring rest of the values.
Any reason, why only the first value is accepted by the API ?
Thanks,
Rapp.If I understand correctly, JPublisher generates a wrapper API for an underlying API that takes a PL/SQL table as an IN parameter. The wrapper will generate and use a SQL nested table as the type for the IN parameter of the wrapper procedure.
The DB adapter DOES support nested tables, varrays, and objects as IN parameters of an API. The problem you are seeing is most likely due to the way you are modeling your BPEL process, specifically with respect to your Assign activities.
When you Assign TO an IN parameter, make sure that you drill down all the way and choose the parameter name in the InputParameters root element. Similarly, when you Assign FROM the API value, you must drill down and choose the name of the OUT parameter in the OutputParameters root element.
In a Transform activity, you would use the FOR construct on the target side to get the values of the nested table or varray from the source side. -
Calling a PL/SQL function returning Netsed Table Rows
Hi,
I am trying to call a Function which returns Nested Table rows (as Out Parameter) in Java .
When I am trying to use
pstmt.registerOutParameter(3, OracleTypes.OTHER);
to capture the Out parameter in Java code , I get the follwoing error :
java.sql.SQLException: Invalid column type
I have even tried using OracleTypes.JAVA_OBJECT ,but I get the same error.
If I use OracleTypes.JAVA_STRUCT I get
java.sql.SQLException: Parameter Type Conflict: sqlType=2008
error.
Please help .
Am I doing the right thing ?
Thanks in advance.
Ninadhttp://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/jdbc20/jdbc20.html
-
How to type cast PL/SQL table to REF cursor?
any one knows how to CAST PL/SQl table to Ref cursor?
eg
procedure some_name(r_out out sys_refcurosr)
IS
type t is table of tab%ROWTYPE;
my_type t;
begin
select * bulk collect into my_type from tab;
r_out := my_type; -- need help here..
end;
it's 10gref cursor is pointer to result set. You can not cast to PL/SQL table.
1 create or replace procedure some_name(r_out out sys_refcursor)
2 IS
3 begin
4 OPEN r_out for select * from emp;
5* end;
SQL> /
Procedure created.
SQL> var mycursor refcursor;
SQL> exec some_name(:mycursor);
PL/SQL procedure successfully completed.
SQL> set linesize 2000
SQL> print :mycursor;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 12/17/80 00:00:00 800 20
7499 ALLEN SALESMAN 7698 02/20/81 00:00:00 1600 300 30
7521 WARD SALESMAN 7698 02/22/81 00:00:00 1250 500 30
7566 JONES MANAGER 7839 04/02/81 00:00:00 2975 20
7654 MARTIN SALESMAN 7698 09/28/81 00:00:00 1250 1400 30
7698 BLAKE MANAGER 7839 05/01/81 00:00:00 2850 30
7782 CLARK MANAGER 7839 06/09/81 00:00:00 2450 10
7788 SCOTT ANALYST 7566 04/19/87 00:00:00 3000 20
7839 KING PRESIDENT 11/17/81 00:00:00 5000 10
7844 TURNER SALESMAN 7698 09/08/81 00:00:00 1500 0 30
7876 ADAMS CLERK 7788 05/23/87 00:00:00 1100 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7900 JAMES CLERK 7698 12/03/81 00:00:00 950 30
7902 FORD ANALYST 7566 12/03/81 00:00:00 3000 20
7934 MILLER CLERK 7782 01/23/82 00:00:00 1300 10
14 rows selected.
Maybe you are looking for
-
Color troubles printing to HP Color Laserjet 2600n
We are a school with a networked environment that includes about 40 Macbook Pros and 60 iMacs. Included in there are several eMacs and PCs. Over the past several weeks, our HP Color LaserJet 2600n printers have begun to exhibit printing where rather
-
Aiport Express or Airport Extreme?
I'm looking for a new wireless router for my home. Range: In my home (just 1100 sq.ft totally), there are 5 rooms (including living room) all on the same floor, separated by brick walls. The router should be installed in one room that is in one corne
-
Additional PR release step while using standard workflow WS20000077
Our current PR release strategy is overall release and based on 3 characteristics: doc type, creation indicator and total value of PR. Release code is relevant to standard workflow WS20000077 with role resolution using user-exit. User exit is based
-
How can I clean up my contacts?
Just got the new iPhone & I have a LOT of redundancy in my Contacts list. Just wondering if there is a faster/easier way to clean that up instead of going through them one at a time?? For example, there are 5 entries for my daughter: 1 for each of he
-
[SOLVED] No kde-lite ?
Hi, -#Linux 3.0-ARCH with kdebase 4.7.0-1 ... I have successfully installed (the full) KDE, in the past as well as now, so i thought I would give the latest "kde-lite" a spin in Arch. But, when I try to install the latest KDE minimal install accord