PL/SQL table
Hi all!What is the PL/SQL table and why use us it?
Help me.
Hello
A PL/SQL table is a table that exists only in PL/SQL blocks. It could be used to create one or more dimension tables in memory, but it has no direct relationship with Oracle Forms.
Try Google on it and you will find many interesting links.
François
Tags: Oracle Development
Similar Questions
-
Nested PL/sql tables passing of ADF
Hi all
I'm moving a nested pl/sql table parameter of adf for the stored procedure.
I have the following code to bind the variable in my AMImpl
ArrayDescriptor desc = ArrayDescriptor.createDescriptor ("STATION_FEATURES_T", st.getConnection ());
TABLE array = new ARRAY (desc, st.getConnection (), stationFeatures);
For the first time, the code runs successfully. However, on the call to the AMImpl method even once, the ArrayDescriptor.createDescriptor get the following error:
java.lang.ClassCastException: oracle.jdbc.proxy.oracle$ $1jdbc $1replay $1driver $1NonTxnReplayableBase $2oracle $1jdbc $1OracleTypeMetaData Array$ $$Proxy cannot be cast to oracle.sql.ArrayDescriptor
I checked that the connection object is done correctly both times.
I also tried to set the setting force = true in ArrayDescriptor.createDescriptor to replace any descriptor be cached.
Pointers would be much appreciated.
You must mention jdev version because there are changes in the ojdbc7 driver (jdev 12 c +).
For example, this (old) approach with ArrayDescriptor.createDescriptor () is deprecated in favour of factory of conn.createOracleArray () or conn.createARRAY () methods.
Also, how do you get 'st' object?
Dario
-
Calling PL/SQL table...
I have a procedure called from a package that returns all the data, the package uses a PL/SQL table that I do not know HOW to call or values that I would need to run the XXINV_PWB_HIST_FCST_PUB. XXINV_PWB_ORG_HIST_TBL (structure) with in the package, can someone tell me how it's done?
Call package is downstairs, the record structure is less than the package call.
DECLARE
P_ITEM_NUMBER VARCHAR2 (200);
DATE OF P_CURRENT_DATE;
X_PWB_ORG_HIST_TBL APPS. XXINV_PWB_HIST_FCST_PUB. XXINV_PWB_ORG_HIST_TBL;
BEGIN
P_ITEM_NUMBER: = NULL;
P_CURRENT_DATE: = NULL;
-Modify the code to initialize the variable
-X_PWB_ORG_HIST_TBL: = NULL;
XXINV_PWB_HIST_FCST_PUB. () GET_ORG_DETAILS
P_ITEM_NUMBER = > 91,
P_CURRENT_DATE = > 2 February 2014 ",
X_PWB_ORG_HIST_TBL = > X_PWB_ORG_HIST_TBL (which values should I put in the section)
);
Legacy release:
DBMS_OUTPUT. PUT_LINE ('X_PWB_ORG_HIST_TBL =' |) X_PWB_ORG_HIST_TBL);
-: X_PWB_ORG_HIST_TBL: = X_PWB_ORG_HIST_TBL;
END;
TYPE XXINV_PWB_Hist_Tbl IS TABLE OF THE XXINV_PWB_Hist_Rec
INDEX OF DIRECTORY;
TYPE XXINV_PWB_Org_Hist_Rec IS RECORD
(
Org_Hist_Index_Id NUMBER: = ".
Item_Number Varchar2 (30): = ".
Number of Quantity_1: = ".
Number of Quantity_2: = ".
Number of Quantity_3: = ".
Number of Quantity_4: = ".
Number of Quantity_5: = ".
Number of Quantity_6: = ".
Number of Quantity_7: = ".
Number of Quantity_Total: = ".
Date of Date_History: = ".
Month_Year Varchar2 (15): = ".
Number of Quantity_8: = ");
Sorry I'm not familiar with PL/SQL tables...
Thank you
Help
I can't go through your entire code. From there, you no need to use this plsql don't table as an input parameter because you do not pass anything... You're just fill with your values hard-coded... Then you can try the below stated
DECLARE
-declare the plsql table
X_PWB_ORG_HIST_TBL APPS. XXINV_PWB_HIST_FCST_PUB. XXINV_PWB_ORG_HIST_TBL;
BEGIN
XXINV_PWB_HIST_FCST_PUB. GET_ORG_DETAILS (91, TO_DATE('02-FEB-2014','DD-MON-YYYY'), X_PWB_ORG_HIST_TBL);
-The legacy output:
BECAUSE me in X_PWB_ORG_HIST_TBL. FIRST... X_PWB_ORG_HIST_TBL. LAST
LOOP
-Add all columns to dbms_output print and test values
DBMS_OUTPUT. PUT_LINE ('X_PWB_ORG_HIST_TBL =' |) X_PWB_ORG_HIST_TBL (i). Org_Hist_Index_Id | «, » || X_PWB_ORG_HIST_TBL (i). Item_Number);
END LOOP;
END;
-
How to execute a SQL statement that is stored within a SQL Table
Hello
If someone please help me with the following problem I would be eternally grateful
I have a SQL statement that is stored inside a certain SQL table, I want to use this SQL statement inside my PL/SQL procedure.
Thought a simple solution was to get the SQL statement in a table, and then run it, but how could I do so exactly with PL/SQL? I only started to play with PL/SQL in the last days.
Thanks in advance!
This is what it looks like more or less:
Display result for:
---------------------
SELECT TRIM (OBJ_VALU_TXT)
OF OBJ_VALU_DOC
WHERE TYPE_OBJET = 'FLD '.
AND OBJECT_CODE = 15443
AND OBJ_VALU_CD = 'CAB '.
ORDER BYDOC_SEQ_NO
00001
------------------------------------------------------------------
SELECT
VALUE (MAX (RECEIPT_NO) + 1,: OUT-COMP-FACTOR)
THE FRONT DESK
WHERE (RECEIPT_NO BETWEEN
(: OUT-COMP-FACTOR AND: OUT TO A NUMBER) OR
(RECEIPT_NO >: OUT-COMP-FACTOR AND)
(: OUT-TO-NUMBER = 0)
Here's a demo of your condition.
create table t (col1 varchar2 (200));
table created
insert into values t ('select * from double ');
1 row inserted
declare
v_col varchar2 (200);
v_val varchar2 (200);
StartSelect col1 in t v_col;
run immediately v_col in v_val;
dbms_output.put_line (v_val);
end;-----
XUse in the clause, you can use as many variables as needed. But the basic approach remains the same.
But storage in DB SQL is not an efficient design.
Ishan
-
SOA calling a MS SQL table to insert data.
Hello
I configured a XA driver to insert data into the MS SQL Server table. When I execute the stream with a SOAP user interface. I was able to insert the data from MS SQL table. But in the end, the transaction is rolled back.
I would ask you
< soapenv:Envelope xmlns:soapenv = 'http://schemas.xmlsoap.org/soap/envelope/' xmlns:mvn = "http://xmlns.oracle.com/MVNEIDM/MVNESelfRegistration/MVNESelfRegistration" >
< soapenv:Header / >
< soapenv:Body >
< mvn:MVNESelfRegistrationRequest >
< mvn:subscriberId > 12345 < / mvn:subscriberId >
< mvn:Keyword > 456 < / mvn:Keyword >
< mvn:completionDt > 2013-02-06 T 16: 24:06.952 < / mvn:completionDt >
< mvn:expirationdt > 2013-02-06 T 16: 24:06.952 < / mvn:expirationdt >
< / mvn:MVNESelfRegistrationRequest >
< / soapenv:Body >
< / soapenv:Envelope >
Erros on SOAP UI are:
< env:Envelope = "http://schemas.xmlsoap.org/soap/envelope/" xmlns:env >
< env:Header / >
< env:Body >
< env:Fault >
env:Server < faultcode > < / faultcode >
incorrect object name < faultstring > [FMWGEN] [SQLServer JDBC Driver] [SQL Server] ' dbo. SelfRegistration'. < / faultstring >
< faultactor / >
< detail >
< exception / >
< / details >
< / env:Fault >
< / env:Body >
< / env:Envelope >
The managed server log the error is
Form weblogic server: -.
Error committing transaction:; nested exception is: Exception [EclipseLink-4002] (Eclipse - 2.1.3.v20110304 persistence Services - r9073): org.eclipse.persistence.exceptions.DatabaseException internal Exception: weblogic.jdbc.sqlserverbase.ddc: invalid object name [FMWGEN] [SQLServer JDBC Driver] [SQL Server] ' dbo. SelfRegistration'. Error code: 208
The process ends with an error, but why he is rolling abck the transaction at the end. The table of the object was existing in the database and I traced the table to insert the data from the input variable reception to invoke the input variable. BPEL Instance he executed until the end, but in the end, the transaction is rolled back.
Thank you
Newcomer RajaInvalid object name ' dbo. SelfRegistration'
I'm assuming you can see a SelfRegistration table in your database... So, I guess that BOD is not the name of the diagram on the right...
-
Performance issue Bulk Insert PL/SQL table type
Hi all
I put in work of a batch to fill a table with a large number of data records(>3,000,000). To reduce the execution time, I used PL/SQL tables to temporarily store data that must be written to the destination table. Once all documents are piling up in the PL/SQL table I use a FORALL operator for bulk insert the records in the physical table.
Currently, I follow two approaches to implement the process described above. (Please see the code segments below). I need to choose how to best wise performance between these two approaches. I really appreciate all the comments of experts about the runtime of the two approaches.
(I don't see much difference in consumption of time in my test environment that has limited the data series. This process involves building a complex set of structures of large product once deployed in the production environment).
Approach I:_
DECLARE
TYPE of test_type IS test_tab % ROWTYPE directory INDEX TABLE;
test_type_ test_type.
ins_idx_ NUMBER;
BEGIN
ins_idx_: = 1;
NESTED LOOPS
test_type_ (ins_idx_) .column1: = value1;
test_type_ (ins_idx_) .column2: = value2;
test_type_ (ins_idx_) .column3: = value3;
ins_idx_: = ins_idx_ + 1;
END LOOP;
I_ FORALL in 1.test_type_. COUNTY
INSERT INTO test_tab VALUES (i_) test_type_;
END;
/
Approach II:_
DECLARE
Column1 IS a TABLE OF TYPE test_tab.column1%TYPE INDEX DIRECTORY.
Column2 IS a TABLE OF TYPE test_tab.column2%TYPE INDEX DIRECTORY.
Column3 IS a TABLE OF TYPE test_tab.column3%TYPE INDEX DIRECTORY.
column1 column1_;
column2_ Column2;
column3_ Column3;
ins_idx_ NUMBER;
BEGIN
ins_idx_: = 1;
NESTED LOOPS
column1_ (ins_idx_): = value1;
column2_ (ins_idx_): = value2;
column3_ (ins_idx_): = value3;
ins_idx_: = ins_idx_ + 1;
END LOOP;
FORALL idx_ in 1.column1_. COUNTY
INSERT
IN n_part_cost_bucket_tab)
Column1,
Column2,
Column3)
VALUES)
column1_ (idx_),
column2_ (idx_),
column3_ (idx_));
END;
/
Best regards
Lorenzo
Published by: nipuna86 on January 3, 2013 22:23nipuna86 wrote:
I put in work of a batch to fill a table with a large number of data records(>3,000,000). To reduce the execution time, I used PL/SQL tables to temporarily store data that must be written to the destination table. Once all documents are piling up in the PL/SQL table I use a FORALL operator for bulk insert the records in the physical table.
Performance is more than just reducing the execution time.
Just as smashing a car stops more than a car in the fastest possible time.
If it was (breaking a car stopping all simply), then a brick with reinforced concrete wall construction, would have been the perfect way to stop all types of all sorts of speed motor vehicles.
Only problem (well more than one actually) is that stop a vehicle in this way is bad for the car, the engine, the driver, passengers and any other content inside.
And pushing 3 million records in a PL/SQL 'table' (btw, that is a WRONG terminology - there no PL/SQL table structure) in order to run a SQL cursor INSERT 3 million times, to reduce the execution times, is no different than using a brick wall to stop a car.
Both approaches are pretty well imperfect. Both places an unreasonable demand on the memory of the PGA. Both are still row-by-row (aka slow-by-slow) treatment.
-
Is it possible to use the record type or a PL/SQL table in the Select statement
Hi all
My requirement is that.
I want to write a query and write a function, function, I want to return multiple columns at the same time in a Select statement.
I select the return values in the Select no statement in a PL/SQL block.
Is it possible to use the PL/SQL Table or Variable of Type record, or any other method in the statement Select?
Please help me understand the solution.
Kind regards830960 wrote:
do we like it?In general, Yes, if the function is a function table, you can do something like:
select t.col1, t.col2, f.col1, f.col2, f.col3 from table_name t, table(some_table_function(param1,...paramN)) f /
SY.
-
Dimension to build using the SQL table and process to populate the SQL table
I have a dimension in a cube that is manually* built by one of our power users. Now, I have to get all the information of members of this dimension in a SQL table (example: with columns... Level0, level0property, level1, level1property etc...) to use this table in the STUDIO for the responsibility of the Member.
Is there any easy process to do this? Currently I am building each line manually in the SQL table and there are 1100 + members in that manually built dimension. Please advice.Look at the outline of applied olap Extractor is a free utility
-
Hello guys,.
I have a few questions about the PL/SQL tables
(1) if I don't specify the 'INDEX BY' clause, they are indexed by PLS_INTEGER default, right?
(2) consider this package specification
So I created a table (I hope it's standard indexed by type of data pls_integer) and I am in him passing as parameter to a procedure. Because I want this parameter be optional I assign null inside.CREATE OR REPLACE PACKAGE Testxyz AS TYPE tab_Numbers IS TABLE OF PLS_INTEGER; PROCEDURE TestNumber(ptab_Numbers IN tab_Numbers := NULL); END Testxyz;
Now, I change the table definition for:
Try to compile it and you get:CREATE OR REPLACE PACKAGE Testxyz AS TYPE tab_Numbers IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER; PROCEDURE TestNumber(ptab_Numbers IN tab_Numbers := NULL); END Testxyz;
Error (5.53): PLS-00382: expression is of the wrong type
Why?
(3) because I need this optional parameter, I use the first statement:
Now I create an anonymous block, and you want to set something in the tableCREATE OR REPLACE PACKAGE Testxyz AS TYPE tab_Numbers IS TABLE OF PLS_INTEGER; PROCEDURE TestNumber(ptab_Numbers IN tab_Numbers := NULL); END Testxyz;
When you try to run it, I got:DECLARE vtab_Numbers TESTXYZ.tab_Numbers; BEGIN vtab_Numbers(1) := 5; END; /
06531 00000 - 'refers to an uninitialized collection.
Can someone help me understand this problem?
Is it possible to have input of type PL/SQL table setting and have a standard null, are assigned?
Thanks, Dan(1) if I don't specify the 'INDEX BY' clause, they are indexed by PLS_INTEGER default, right?
N ° or somehow.
More critical, and using official terms of [url http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/composites.htm#CHDBHJEI] documentation so that we don't get into unnecessary arguments about the correct terms for these features, it's the difference between types of ASSOCIATIVE TABLE and the IMBRIQUEE TABLE collection.
If you omit the "INDEX BY" clause, it is a type of TABLE IMBRIQUEE collection. A type of TABLE IMBRIQUEE is always indexed by PLS_INTEGER.
When you include the ' INDEX OF ', this is an ASSOCIATIVE ARRAY.
(2) consider this package specification
Try to compile it and you get:
Error (5.53): PLS-00382: expression is of the wrong typeWhy?
Because you cannot assign NULL to an ASSOCIATIVE ARRAY.
In the same way, you cannot do this:
SQL> DECLARE 2 TYPE tab_Numbers IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER; 3 v1 tab_Numbers; 4 BEGIN 5 v1 := NULL; 6 END; 7 / v1 := NULL; * ERROR at line 5: ORA-06550: line 5, column 8: PLS-00382: expression is of wrong type ORA-06550: line 5, column 2: PL/SQL: Statement ignored SQL>
If you want two entry points to TestNumber with an ASSOCIATIVE ARRAY or NULL then overload the procedure.
If you want to call a procedure with a TABLE IMBRIQUE collection type you can the default empty:
SQL> CREATE OR REPLACE PACKAGE Testxyz 2 AS 3 TYPE tab_Numbers IS TABLE OF PLS_INTEGER; 4 PROCEDURE TestNumber(ptab_Numbers IN tab_Numbers DEFAULT tab_Numbers()); 5 PROCEDURE TestNumber; 6 END Testxyz; 7 / Package created. SQL>
(3) because I need this optional parameter, I use the first statement
When you try to run it, I got:
06531 00000 - 'refers to an uninitialized collection.Because you have not initialized it.
Different collection types require different semantics.
SQL> DECLARE 2 TYPE tab_Numbers IS TABLE OF PLS_INTEGER; 3 v1 tab_Numbers; 4 BEGIN 5 v1(1) := 5; 6 END; 7 / DECLARE * ERROR at line 1: ORA-06531: Reference to uninitialized collection ORA-06512: at line 5 SQL> DECLARE 2 TYPE tab_Numbers IS TABLE OF PLS_INTEGER; 3 v1 tab_Numbers := tab_Numbers(); 4 BEGIN 5 v1(1) := 5; 6 END; 7 / DECLARE * ERROR at line 1: ORA-06533: Subscript beyond count ORA-06512: at line 5 SQL> DECLARE 2 TYPE tab_Numbers IS TABLE OF PLS_INTEGER; 3 v1 tab_Numbers := tab_Numbers(); 4 BEGIN 5 v1.extend(); 6 v1(1) := 5; 7 END; 8 / PL/SQL procedure successfully completed. SQL>
-
Hi all
Newbie when it comes to PL/SQL tables...
Can someone explain to me why it works and how exactly I can do the following without triggering an error?
I have a function that accepts a PL/SQL table like in parameter.
The PL/SQL table is defined as...
the xxtzg_otl_iface_stg table has many columns including error_message and error_flag. If I find an error, I want to update the error_message and error_flag function. If I can get it works I will then modify the function to return to the table of PL/SQL instead of BOOLEANType TTimeTable is table of xxtzg_otl_iface_stg%rowtype index by binary_integer;
FUNCTION validate_timecard (pTimeTable IN TTimeTable ) RETURN BOOLEAN IS lc_module CONSTANT VARCHAR2(25) := 'validate_timecard'; lEmployeeCount PLS_INTEGER; lEmployeeError VARCHAR2(1000); lErrorCount PLS_INTEGER :=0; BEGIN FOR i IN 1 .. NVL(pTimeTable.COUNT,0) LOOP xxtzg_concurrent_utils_pkg.write_log( p_package => gc_package , p_module => lc_module , p_text => 'Processing timecard for employee_number: '||pTimeTable(1).employee_number ); -- Call validations before submitting the timecard to the API --validate employee begin select count(*) into lEmployeeCount from per_all_people_f where employee_number = pTimeTable(1).employee_number; if lEmployeeCount = 0 then -- Set the errors -- This assignment below does not work, I get an error message saying... --[Error] PLS-00363 (137: 27): PLS-00363: expression 'PTIMETABLE.ERROR_MESSAGE' cannot be used as an assignment target PTimeTable(i).error_message := 'Employee Number '||pTimeTable(1).employee_number||' is not a valid employee'; PTimeTable(i).error_flag := 'Y'; end if; end; END LOOP; IF lErrorCount = 0 THEN RETURN TRUE; ELSE RETURN FALSE; END IF; END;
blue72TA wrote:
FUNCTION validate_timecard (pTimeTable IN TTimeTable ) RETURN BOOLEAN IS ... -- This assignment below does not work, I get an error message saying... --[Error] PLS-00363 (137: 27): PLS-00363: expression 'PTIMETABLE.ERROR_MESSAGE' cannot be used as an assignment target PTimeTable(i).error_message := 'Employee Number '||pTimeTable(1).employee_number||' is not a valid employee'; PTimeTable(i).error_flag := 'Y';
Your table is declared as IN only (the default if you do not explicitly set it), so you are not allowed to change its attributes in all respects, IN = read-only.
If you want to be able to modify the values of a parameter, it must be declared as OUT parameters.
-
Variable from PL/SQL table?
Hello
I need to process some data in PL/SQL.
The first thing I would do, is to write a query that collects all the mydata from different tables in exactly one table on which I can make simple queries.
What is the preferred way to do this?
Temporary table, or view, or something else?
I would preffer not not to create the physical table for this. I want to use only a PL/SQL variable.
Thank youuser610868 wrote:
HelloThanks for your advice, but I would still do it.
Is it possible or not? (fully searchable custom table in a PL/SQL variable)Yes and no.
Yes, it is possible to get all your data and put it in a PL/SQL 'table' (better known as an array or a collection, because they are not tables)
No, you will not be able to 'interrogate' the data in this array/collection, simply because there isn't a table, and SQL will not work against it.You can do all kinds of PL/SQL code to process the data in the table or the collection to simulate what would do SQL, but it will be several times slower than that of SQL, and to be honest, no expert here is likely to give you code to do because it's just the wrong way to do things.
If you can give a legitimate situation where you needed to load the data in a table or the collection in order to treat it, then of course someone can show you how to do this, but it is likely that most of the situations describe you would be better made using SQL tables from database etc..
-
If I said PL/SQL table and populated with 10 values.
If I want to find a perticular values are in the list populated how can I find.say I have values from 1 to 10.
and I want to find if 9 is in the list.
I tried with loop. Is there another way. I use 10g.
declare
tr_nm number_array;
i the number;
Start
I'm in 1.10
loop
tr_nm.extend;
tr_nm (i): = i;
end loop;
for j from 1... tr_nm. Count
loop
If tr_nm (j) = 9 then
i: = i + 1;
end if;
end loop;
If i > 0 then
null;
end if;
end;Please try this code
Note: this code runs from 10 g.DECLARE type num_type is table of NUMBER; v_num_arr num_type; v_num number; v_var number :=9; BEGIN select level bulk collect into v_num_arr from dual connect by level <=10; dbms_output.put_line('Count - '||v_num_arr.count); if v_var member of v_num_arr then dbms_output.put_line('Found '); end if; END;
-
What is the best TWG or Pl/Sql Table
Hello
One of the best MNC asked me a question. for example,.
What is the global temporary Table table / b/w difference Pl/Sql? What is the best to maintain the data manipulations?
Pls advise me... !!
for example, it is very useful.
Adv.Thanks
PrabhuAs usual if you search for it you would have found your answer at this time.
He has already been asked here before and responded. The link is
Concerning
REDA
-
Pl/sql table as an input parameter
Hello.
I need to know if it is possible to use a pl/sql table as an input parameter to a stored procedure in a package.
Right now I ve compiled the procedure correctly, but when I try to call, I´ve-PLS-00330.
EXAMPLE:
This is the package:
CREATING a PACKAGE test IS
TYPE table_list IS TABLE OF VARCHAR2 (20) INDEX directory.
PROCEDURE proc_test (list IN table_list);
END TEST;
/
Test to CREATE THE PACKAGE BODY IS
PROCEDURE proc_test IS
BEGIN
BECAUSE me IN the list. ... FIRST list. LAST
LOOP
DBMS_OUTPUT. Put_line (i);
END LOOP;
END proc_test;
END test;
/
And I m trying to call with a block anonimous like this:
BEGIN
DECLARE
TYPE Œ IS TABLE OF VARCHAR2 (20) INDEX directory.
BEGIN
call_list (1): = "my_record_1";
call_list (2): = "my_record_2";
call_list (3): = "my_record_3";
test.proc_test (call_list);
END;
And then, I ve
ORA-06550: line 8, column 2:
PLS-00330: invalid use of the name of type or subtype
Do you understand how I have to do?
Thanks for your help.
Respect ofYou call it with the type that you defined.
BEGIN DECLARE call_list test.table_list := test.table_list(); BEGIN call_list(1) := 'my_record_1'; call_list(2) := 'my_record_2'; call_list(3) := 'my_record_3'; test.proc_test(call_list); END;
-
How to find the second largest in a pl/sql table
Hello friends,
I want to find the first and second maximum items in a pl/sql table.
Here's the code...
DECLARE
Max_earnings_type TYPE TABLE IS NUMBER;
max_earnings_tab max_earnings_type: = max_earnings_type();
number of v_count: = 0;
number of v_max_earnings;
Can someone give me how to find the maximum first max and second in the type of the given table.
appreciate your help.
Thank you/kumar
Published by: kumar73 on October 21, 2010 09:42kumar73 wrote:
When I tried to implement your logic in my application, I get the following error...
PL/SQL: digital or value error: NULL index key value table
What happens if the PL/SQL table has NULL values. Question is how you want to handle NULL values. You want to ignore nulls as GROUP BY do? If you want to consider NULL values, you can say if you want to order the NULLS FIRST or NULLS LAST. I guess that logical GROUP BY:
DECLARE TYPE max_earnings_type IS TABLE OF NUMBER; TYPE max_earnings_sorted_type IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; max_earnings_tab max_earnings_type; max_earnings_tab_sorted max_earnings_sorted_type; BEGIN SELECT sal + comm BULK COLLECT INTO max_earnings_tab FROM emp; FOR v_i in 1..max_earnings_tab.count LOOP IF max_earnings_tab(v_i) IS NOT NULL THEN max_earnings_tab_sorted(max_earnings_tab(v_i)) := 1; END IF; END LOOP; DBMS_OUTPUT.PUT_LINE('MAX value in PL/SQL table is ' || nvl(to_char(max_earnings_tab_sorted.last),'NULL')); DBMS_OUTPUT.PUT_LINE('Second MAX value in PL/SQL table is ' || nvl(to_char(max_earnings_tab_sorted.prior(max_earnings_tab_sorted.last)),'NULL')); END; / MAX value in PL/SQL table is 2650 Second MAX value in PL/SQL table is 1900 PL/SQL procedure successfully completed. SQL> SELECT sal + comm 2 FROM emp; SAL+COMM ---------- 1900 1750 2650 1500 SAL+COMM ---------- 14 rows selected. SQL>
SY.
-
How to create a type of record and a pl/sql table of this record type in the database
Hello
I want to create a record type, and then I want to create a PL/SQL table in the oracle 9i database.
I did block PL/SQL.
But when I'm doing it in the database it throws me a few errors.
Could you please tell me how can I do?
Concerninguser576726 wrote:
Hello
I want to create a record type, and then I want to create a PL/SQL table in the oracle 9i database.
I did block PL/SQL.
But when I'm doing it in the database it throws me a few errors.
Could you please tell me how can I do?Concerning
RECORD type is only supported in PL/SQL for SQL, you must use the OBJECT type.
Maybe you are looking for
-
spam is not to the junk e-mail folder
Suddenly, my junk mail is NOT moved to the junk e-mail folder, it's been marked as junk, but it remains in the mail folder in bulk. It has always worked before, it started about 2 weeks ago. I saw all the adjustment, you click on recycling and all th
-
HP Envy 750-114: hp envy 750-114-added to a graphics card
I am to buy HP Envy 750-114 and upgrade with a graphics card. The one I found is low power, so it will be fine with the 300 watt power supply that comes with 750-114 envy. The problem is I want to order the video card for a refund until the PC (the
-
How to fix a test failure short DST?
I have an e1405 dell with windows xp home edition and the last time I tried to turn it on crossed the screen of windows xp and then came to a black screen that says "no bootable disk" and gave me the opportunity to try to restart or run the Setup uti
-
I have a Windows Vista Home Premium with a 64 processor. It is able to run 64-bit programs and 32-bit. It seems (wired) LOL, to run 64-bit programs. I understand that it saves space on the CPU? I'm desperate to run the most recent version of Adobe F
-
Major problems in scanning with c410a all-in-one...
In courses run a Windows 8.1 high-end desktop system with a huge amount of memory and have experienced a tremendous amount of problems printing & scanning with my c410a. I have run the maintenance on this pc daily cleaning Cache, Virus scan, all and