Direct assignment of a table PLSQL using rowtype
I have a collection as follows defeinedtype t_type1 is table of tab1% rowtype;
v_type1 t_type1;
The table tab1 has the following columns - c1, c2
How can I directly attribute values (Exodus 21: 22 for c1 and c2), to the collection - v_type1.
Please help if possible. Thank you.
You should then index.
SQL> declare
2 type tbl is table of t%rowtype index by binary_integer;
3 lTbl tbl;
4 begin
5
6 lTbl(1).col1:=1;
7 lTbl(1).col2:=2;
8 lTbl(2).col1:=3;
9 lTbl(2).col2:=4;
10
11 for i in 1..lTbl.count
12 loop
13 dbms_output.put_line(lTbl(i).col1||'-'||lTbl(i).col2);
14 end loop;
15 end;
16 /
1-2
3-4
PL/SQL procedure successfully completed.
Published by: Karthick_Arp on September 3, 2008 02:28
Tags: Database
Similar Questions
-
How to insert data into the table by using the expression builder in the assign activity
How to insert data into the table by using the expression builder in affect business in BPEl, I use SOA Suite 11.1.1.5
Can someone help me pleaseHello
I don't think that oraext:query-database() can insert data into the table.
What are your needs?
Can not you plan to use the DB adapter with the insert operation?Kind regards
Neeraj Sehgal -
ADF - Model collection assign to Rich Table
In a managed bean, I create a rich array, but then I want to entrust an existing model of collection viewObject.
I tried without success to the following:
RichTable itemDtlTable = new RichTable(); itemDtlTable.setValue("#{bindings.GisWebLayerHdrView1.collectionModel}");
Any ideas?
-Andreas
So finally, you are able to assign collectionModel to table
BdW what is the code in getElExpression
and when you have created the table and column manually then just use outputText to display the data within the column, why are you using dynamicComponent inside the column?
Rot RichOutputText = new RichOutputText();
rot.setValue (getValueExpression("#{row.bindings[mycolumn.name].inputValue}"));
and add this column to the table, as you use row , I see that you have attributed this as a var of table
You will have to set like this inorder to make use of the model of table collection
itemDtlTable .setVar ("row");
Andreas, it's complicated
Ashish
-
Can we do a direct update on fnd_concurrent_programs table
Hi team,
Can someone help me with this.
I have a requirement where I need to put the print_flag = "n" for all concurrent programs including Pavilion printer is "O".
to do this, can I use a direct update statement or is there a standard API to update the column in the fnd_concurrent_programs table.
My update statement:
Update fnd_concurrent_programs set print_flag = ' no where print_flag = 'Y ';
Can I go ahead with above the sql statement to update or do I need to use the api.
at the same time I just want to check, can I do a direct update on fnd_concurrent_requests table too?
Can someone help me on this.
Can I go ahead with above the sql statement to update or do I need to use the api.
at the same time I just want to check, can I do a direct update on fnd_concurrent_requests table too?
Yes you can, for the two tables.
Here are some examples:
For FND_CONCURRENT_PROGRAMS:
For FND_CONCURRENT_REQUESTS, see (Doc ID 134007.1).
Thank you
Hussein
-
Editing and creating tables PLSQL. Understanding.
Guys hope that someone can help me. I'm trying to understand how it works.
If I select a record from a table to a pl sql table I get for example the lines by index
It does something like/*using bulk select*/ SELECT rowid, f.* BULK COLLECT INTO invoice FROM INVOICES f --WHERE PO = 'P0126061' ORDER BY f.fwtmp_regpo_po asc, f.FWTMP_REGPO_INV_NUM Asc, f.fwtmp_regpo_line_nbr ASC, f.fwtmp_regpo_seq_nbr ASC;
[1]
vendor_numbrer 999
vendor_invoice 1234
[2]
vendor_numbrer 997
vendor_invoice 12ty
now im trying to replicate this by using a table plsql how do I go on acomplishing it? I can dod it?
can anyone provide an example on how to do this?TYPE PostingTbl_type IS TABLE OF VARCHAR2(1000); Posting PostingTbl_type := PostingTbl_type(); /*and i try to do something like */ /*sudo code*/ posting(1).somefield := 'lalalala' /*but this does not work?*/
I'm mainly looking to have multiple values in an index as of the select in bulk.
Thank you
Miguel
Published by: mlov83 on November 8, 2012 10:38Hello
Is that what you want?
DECLARE TYPE R_TEST IS RECORD (F_NAME VARCHAR2(100), L_NAME VARCHAR2(100)); TYPE TAB_OF_R_TEST_TYPE IS TABLE OF R_TEST; TAB_OF_R_TEST TAB_OF_R_TEST_TYPE := TAB_OF_R_TEST_TYPE(); BEGIN TAB_OF_R_TEST.EXTEND; TAB_OF_R_TEST(1).F_NAME := 'FIRST'; TAB_OF_R_TEST(1).L_NAME := 'LAST'; DBMS_OUTPUT.PUT_LINE(TAB_OF_R_TEST(1).F_NAME || ', ' || TAB_OF_R_TEST(1).L_NAME); END; result: FIRST, LAST
Kind regards
Peter
-
Quick way to assign the IDs table header cells to data?
Acrobat X (10.1.9)
For the accessibility of tables with complex headers, is there a quick way to assign the ID of the header cells to data associated with them? I have not found a way faster than go to one cell at a time.
All tags already have an ID, this question is how quickly assign the ID of header cells to all data cells in a row or a column.
Better yet, is there a function or plugin that looks like to a table column and line and automatically assigns the headers for all data cells?
I used the Table Inspector in Acrobat and several years of the CommonLook plug-in version. Both allow you to set several properties for all the cells in a selection. And they act as if they fortunately put header IDs for multiple cells, but after clicking OK and watch the cell properties, TI is not set for any of them, and CL only sets it to the first cell that has been selected.
I prepare a PDF file of scientific reports for Section 508 compliance. Often, they are hundreds of pages long and got the results of large tables. Some clients insist on complex headers. Cell by cell is surprisingly long.
I am running the latest version of CommonLook and manages to assign very well identification tags. You can select multiple cells and assign them to a header. You can also select the same cells and assign them to another heading using "Append". This will add the new header, without deleting the header already assigned. In earlier versions Append has not worked for me. That's what you need, if you have complex tables for a long time. If you get the latest version and this isn't the case call Technical Support, as the plugin does not work correctly. The Touch Up reading order tool does not.
I sometimes create a white/hidden text for the header text that spans several columns and then create individual
to keep them, but I wouldn't rely on it for long tables or use it as my main method. It's a pretty quick solution in some cases - or if your author likes to let in line 1, column 1 white, you can create your own invisible header for the screen reader. But it is too difficult to verify, and not the best route to follow. Also the hidden text is considered a no-no by some as it is supposed to be a drop out / drop behind or mistake to layout. -
How to upgrade a table column using the values in the Oracle collection
On the "BOLD" line, I don't know how I should move the values of the collection of name I said without which are set all the values in the table supplier_16 = 'Saral.create or replace procedure test_coll IS CURSOR upd IS SELECT CONTACT_NAME FROM Supplier_16; TYPE dept IS TABLE OF upd%rowtype; cur_var dept; Type List Is table Of varchar2(20); Name List:= List('Shilpi','Sunil','Shreyas','Saral'); BEGIN OPEN upd; LOOP FETCH upd BULK COLLECT INTO cur_var; -- EXIT WHEN upd%NOTFOUND; FORALL i IN cur_var.FIRST..cur_var.LAST UPDATE supplier_16 ** SET Contact_name= name(i); *** COMMIT; END LOOP; CLOSE upd; END;
Help, please.Aashish S. wrote:
Thank you very much...Yes, I slide collections and was trying to reach somwthing on similar lines to which you provided the code example...
My essay is equipped to take a collection: initialized with values of say 3-4...
Take other tables... A column... and update the column in the table (not PK, FK anything) using the values of the initialized collection...
However, I am stuck between the two on how the UPDATE clause should be...
OK, if it's just because you want to practice with collections, you might do something like this...
SQL> set serverout on SQL> create table supplier_16 as 2 select 'Frederick' as contact_name from dual union all 3 select 'Robert' from dual union all 4 select 'Jeremy' from dual union all 5 select 'Simon' from dual 6 / Table created. SQL> create or replace procedure test_coll is 2 CURSOR upd IS 3 SELECT CONTACT_NAME 4 FROM Supplier_16 5 FOR UPDATE; 6 Type List Is table Of varchar2(20); 7 Name List := List('Shilpi','Sunil','Shreyas','Saral'); 8 v_contact_name varchar2(30); 9 v_idx number := 1; 10 BEGIN 11 OPEN upd; 12 LOOP 13 FETCH upd INTO v_contact_name; 14 EXIT WHEN upd%NOTFOUND; 15 UPDATE supplier_16 16 SET contact_name = name(v_idx) 17 WHERE CURRENT OF upd; 18 DBMS_OUTPUT.PUT_LINE(v_contact_name||' update to '||name(v_idx)); 19 v_idx := v_idx + 1; 20 END LOOP; 21 CLOSE upd; 22 COMMIT; 23 END; 24 / Procedure created. SQL> exec test_coll; Frederick update to Shilpi Robert update to Sunil Jeremy update to Shreyas Simon update to Saral PL/SQL procedure successfully completed. SQL> select * from supplier_16; CONTACT_N --------- Shilpi Sunil Shreyas Saral
Of course, there is treatment rank by rank and is not best for performance, but it allows you to access your collection that you created names.
-
TABLE OF departments % ROWTYPE - error
Hi all
Could you please let me know what's wrong with this code?
DECLARE
TYPE departments_table IS TABLE OF departments % ROWTYPE directory INDEX;
departure of departments_table;
BEGIN
FOR I IN 1.10 LOOP
SELECT * INTO departments FROM starting (i) WHERE department_id = i;
END LOOP;
FOR I IN 1.10 LOOP
DBMS_OUTPUT. Put_line (to_char (departure, (i), .department_id));
END LOOP;
END;
/
I get this error:
Error from the 1 in the command line:
DECLARE
TYPE departments_table IS TABLE OF departments % ROWTYPE directory INDEX;
departure of departments_table;
BEGIN
FOR I IN 1.10 LOOP
SELECT * INTO departments FROM starting (i) WHERE department_id = i;
END LOOP;
FOR I IN 1.10 LOOP
DBMS_OUTPUT. Put_line (to_char (departure, (i), .department_id));
END LOOP;
END;
Error report:
ORA-01403: no data found
ORA-06512: at line 7
01403 00000 - "no data found".
* Cause:
* Action:
Thank you!!!I'll use the dept table because that's what I have in my diagram of test...
SQL> ed Wrote file afiedt.buf 1 DECLARE 2 TYPE departments_table IS TABLE OF dept%ROWTYPE INDEX BY BINARY_INTEGER; 3 depart departments_table; 4 BEGIN 5 SELECT * 6 BULK COLLECT INTO depart 7 FROM dept; 8 FOR i IN 1..depart.LAST 9 LOOP 10 DBMS_OUTPUT.PUT_LINE(to_char(depart(i).deptno)); 11 END LOOP; 12* END; SQL> / 10 20 30 40 50 PL/SQL procedure successfully completed.
Your problem is trying to separately read the rows in the department table, but do not meet when no data is returned (that is, the number of Department is not found).
SELECT statements in PL/SQL, that do not return a line cause a mistake NO_DATA_FOUND. -
Creating a collection of level schema using % ROWTYPE
Hi all
is it possible to create a record of the collection at the schema level using % ROWTYPE? I try to do this:
I was complaining ' illegal reference to the hr.employees table (I used the hr sample schema).» Any ideas?SQL> create or replace type some_type is table of hr.employees%rowtype; 2 / Warning: Type created with compilation errors. SQL> sho err Errors for TYPE SOME_TYPE: LINE/COL ERROR -------- ----------------------------------------------------------------- 0/0 PL/SQL: Compilation unit analysis terminated 1/31 PLS-00329: schema-level type has illegal reference to HR.EMPLOYEES
Best regards
ValValerie Debonair wrote:
is it possible to create a record of the collection at the schema level using % ROWTYPE? I have
No. + % RowType + is a macro compiler of PL/SQL used by the PL/SQL engine to generate a record structure.
The SQL engine does not support PL/SQL data types - just as the engine SQL does not support C/C++ or Java or c# data types.
PL/SQL, however, integrates SQL - and if it supports all SQL data types. SQL is SQL SQL... it does not support the 3rd languages like PL/SQL or Java or C/C++.
So if you want to have a definition that you specify, it must be a "pure" SQL data type (not PL/SQL). And this data type that results can be used in PL/SQL and C/C++ and Java, and so on.
-
Direct load in external tables
Can we use direct load in external tables? or set DIRECTLY in the external table script?
Thank you.polasa wrote:
Can we use direct load in external tables? or set DIRECTLY in the external table script?Thank you.
N ° why? Because an external table does not load data. It's more like a pointer and an instruction how to read a file.
The big difference between SQL Loader and an external table, SQL Loader is actually two things.
(a) it reads a file from the file system
(b) it inserts these values into a table in the database.An external table only one).
However, you can do a quick insertion of this external table in an actual database table so that is sought.
insert /*+append */ into myRealTable (colA, ColB, colC) select * from myExternalTable
Append it and perhaps also the parallel indication will be close to a direct path insert.
-
Name of the item too long when you use ROWTYPE
I encountered a problem with the xml elements names longer than 30 characters. Seems that it has something to do with ROWTYPE. Creation of this function is successful:
< pre >
FUNCTION to CREATE or REPLACE test_fnc
RETURN OF XMLTYPE
AS
var_return XMLTYPE.
l_dummy DUAL.dummy%TYPE;
BEGIN
SELECT dummy INTO l_dummy FROM DUAL;
SELECT XMLCONCAT (XMLELEMENT)
"TEST."
XMLFOREST)
l_dummy "THIS_IS_OVER_30_CHARACTERS_LONG".
)
))
data_set
IN var_return
FROM DUAL;
RETURN var_return;
END test_fnc;
/
< / pre >
However, the specification of the ROWTYPE variable gives error ORA-00972 (except if I shorten the name of the item...):
< pre >
FUNCTION to CREATE or REPLACE test_fnc
RETURN OF XMLTYPE
AS
var_return XMLTYPE.
l_dummy DOUBLE % ROWTYPE;
BEGIN
SELECT dummy INTO l_dummy FROM DUAL;
SELECT XMLCONCAT (XMLELEMENT)
"TEST."
XMLFOREST)
l_dummy. Dummy "THIS_IS_OVER_30_CHARACTERS_LONG."
)
))
data_set
IN var_return
FROM DUAL;
RETURN var_return;
END test_fnc;
/
< / pre >
Has anyone previously met, or have any ideas for a solution? I could specify all my variables as TYPE, but as there are many in the tables it would be easier to use ROWTYPE.
Oracle Database 11 g Enterprise Edition Release 11.1.0.6.0 - 64 bit Production
Thank you.This works if you add 'AS' after l_dummy.dummy
SQL> CREATE OR REPLACE FUNCTION test_fnc 2 RETURN XMLTYPE 3 AS 4 var_return XMLTYPE; 5 l_dummy DUAL%ROWTYPE; 6 BEGIN 7 SELECT dummy INTO l_dummy FROM DUAL; 8 9 SELECT XMLCONCAT(XMLELEMENT ( 10 "TEST", 11 XMLFOREST ( 12 l_dummy.dummy AS "THIS_IS_OVER_30_CHARACTERS_LONG" 13 ) 14 )) 15 data_set 16 INTO var_return 17 FROM DUAL; 18 RETURN var_return; 19 END test_fnc; 20 / Function created.
Ants
-
Can I connect my HP4625 all in one directly on my ipad/iphone without using a wifi network. ?
Hi xxtopgunxx,
Welcome to the HP Support forums. I understand you want to print from your devices Apple to your printer Deskjet Ink Advantage 4625 without the printer is connected to a wireless network.
It is possible that we can get the printer to disseminate its own network. Please note that the network will broadcast the printer will not have access to the internet. Please follow the steps below:
- On the front panel of the printer, please press the wireless button
- By using the buttons on the right, highlight and select wireless settings
- Highlight and select Restore Defaults
- Select Yes. A message appears indicating that the default values of the network have been restored
- Open your application settings on your Apple device, please
- Please click on wifi and choose the network that starts with "HP-SETUP. This should connect to your Apple device to the printer
- Now you should be able to print using the 'Action' icon. If there is not a print option when you press the action icon following all guidelines for Apple AirPrint
If you go to print and your Apple device does not see the network, you will need to follow the procedure again. It should be at least 60 minutes before the HP - Setup network ceased broadcasting.
-
How to check a table is used by how interface as well as the name of the interface
Hi Experts,
I have only one requirement that a single table, as example abcd table is used by how many interfaces and I also want to list of interfaces where abcd table is used.
Thank you.
Arun
Hi 2691855,
In the models pane of ODI Studio you can expand your store data and used by to see where it is used:
(I use ODI 12 c so it refers to the maps but it works the same way for the interfaces in ODI11g).
You can also use a query on the repository to retrieve all the associations table/interface.
For example:
select NVL(S.TABLE_NAME, S.SRC_TAB_ALIAS) source, I.TABLE_NAME target, I.POP_NAME from SNP_POP i, SNP_DATA_SET ds, SNP_SOURCE_TAB s where I.I_POP = DS.I_POP and DS.I_DATA_SET = S.I_DATA_SET -- and S.TABLE_NAME = '
' It will be useful.
Best regards
JeromeFr
-
To loop through the table and use the values returned in another query
Hello
I tried to do something very simple, but still can not.
I am trying to iterate on a table and use each line of a column in a where clause to display a query clause.
For example:
I want to retrieve all users of dba_users pass it to a clause where clause in a query to show for example account_status and profile of each user. But I want to do it in a way if I can turn the result in an html table.
I tried too much really, so I'll post something that does not work, but which I think will show the problem I have,
BEGIN FOR i IN (SELECT username from dba_users order by 1) LOOP EXECUTE IMMEDIATE 'select account_status from dba_users where username like ''||i.username||'''; END LOOP; END; /
Example of what I want to achieve:
Suppose that there are two users, SYS, and SCOTT:
USERNAME PROFILE ACCOUNT_STATUS ------------------------------ ------------------------------ -------------------------------- SYS DEFAULT OPEN USERNAME PROFILE ACCOUNT_STATUS ------------------------------ ------------------------------ -------------------------------- SCOTT DEFAULT OPEN
Thanks in advance for your time,
OD
Hi Bill,
Bill Citad kirjoitti:
What a join or a sub query going to help me? honestly
-- join select s.sql_id, h.loads_total from dba_hist_sqlstat h join v$sql s on ( h.sql_id = s.sql_id ) where rownum < 3 ; -- subquery select sql_id, loads_total from dba_hist_sqlstat where sql_id in ( select sql_id from v$sql where rownum < 3 ) ; -- correlated subquery select sql_id, loads_total from dba_hist_sqlstat where exists ( select null from v$sql where sql_id = dba_hist_sqlstat.sql_id ) and rownum < 3 ; -- lateral inline view (12c) select s.sql_id, h.loads_total from dba_hist_sqlstat, lateral( select sql_id from v$sql where sql_id = h.sql_id ) s where rownum < 3 ;
-
Which table is used to back up the payload human task
Hi Experts,
I need to write a client java to access the bpm to human load task request, could you tell me which table is used for s
Hello
What you can do is use the Worklist API to retrieve the payload and use xpath and xquery to search in your payload.
Antonis
Maybe you are looking for
-
Hello My first post! Please be gentle! I put my watch was updated to WatchOS3 and left for maybe half an hour. Came back, and it seemed that it was done. I took the watch away from my phone and then realized it was not full... Returned the watch clos
-
4540 proBook s: Audio Driver for HP Probook 4540 s Using Windows 10 (64-bit)
HP has a lot of Windows 10 for a Probook s 4540 using 64 bit drivers, but not a sound driver. Windows Media Player does not work with the driver for Windows 8. Not only that I can not create a recovery drive, software registration system. One o
-
Problem starting recovery Z570
Hey guys. I have laptop with win 7 homepremium z750 ideapad and his works fine since I installed win 8... the problem now tries to use the recovery with a key recovery normally open program I choose System Recovery then restart and boot into Windows
-
I have Microsoft Windows Vista Home premium, Version 6.0 (Build 6002: Service Pack 2), was Norton Internet Security. Cursor autour breaks and clicks in the Middle words or a page, when you type, selects areas of the document when writing and by typin
-
Cannot run Hello world on v4.2
Hello I have just installed JDE v4.2, responsible for the sample workspace, set Hello World as only active project and he ran. The Simulator loaded fine, but when I try to run it, I get a MissingResourceException. Com.rim.samples.device.resource.Hell