Add the column in the collection
Hi gurus
I created 1 collection as below:
Create the Collection with the type of table emp
type c_emp is the table emp % rowtype;
v_emp:=c_emp() c_emp;
Now I want to add more than 2 columns in this collection, first name of the column is varchar2 (10) and and 2nd name column is varchar2 (10) s but unable to understand how will I achieve this?. Please guide. Thank you
Concerning
Shu
I created 1 collection as below:
Create the Collection with the type of table emp
type c_emp is the table emp % rowtype;
v_emp:=c_emp() c_emp;
Now I want to add more than 2 columns in this collection, first name of the column is varchar2 (10) and and 2nd name column is varchar2 (10) s but unable to understand how will I achieve this?.
You cannot change this collection. You must create a new. And you use no reserved words (for example, the "group") for the names.
DECLARE
CURSOR c1 IS (SELECT e.*, cast (null as varchar2 (10) GroupName, cast (null as name varchar2 (10))))
FROM emp e);
TYPE typ_tbl IS TABLE c1% rowtype;
v typ_tbl;
BEGIN
. . .
Tags: Database
Similar Questions
-
Hello
I use oracle 10g
I need help to add the output (collection) of a procedure in the main proc. How acchive with it, using temporary tables.
Thank youCREATE OR REPLACE TYPE t_domain_obj AS OBJECT ( account_id varchar2 (60), org_id varchar2 (60), org_name varchar2 (100), org_role number, associated_id varchar2 (60) ); CREATE OR REPLACE TYPE t_domain_tab IS TABLE OF t_domain_obj; CREATE OR REPLACE TYPE array_element AS TABLE OF number; / CREATE TABLE t_acc ( acc_no number ); INSERT INTO t_acc (acc_no) VALUES(1); INSERT INTO t_acc (acc_no) VALUES(2); CREATE TABLE t_domain ( account_id varchar2 (60), org_id varchar2 (60), org_name varchar2 (100), org_role number, associated_id varchar2 (60) ); INSERT INTO t_domain ( account_id, org_id, org_name, org_role, associated_id ) VALUES('1', '2', 'ORGID_1', 1, SUP_1'); INSERT INTO t_domain ( account_id, org_id, org_name, org_role, associated_id ) VALUES('1', '2', 'ORGID_1', 3, NULL); INSERT INTO t_domain ( account_id, org_id, org_name, org_role, associated_id ) VALUES('1', '3', 'ORGID_1', 1, 'SUP_1'); INSERT INTO t_domain ( account_id, org_id, org_name, org_role, associated_id ) VALUES('2', '1', 'ORG_2', 1, NULL); CREATE OR REPLACE PROCEDURE domain (accid IN number, domain_out OUT t_domain_tab ) AS BEGIN SELECT t_domain_obj (account_id, org_id, org_name, org_role, associated_id ) BULK COLLECT INTO domain_out FROM t_domain WHERE account_id = accid; END; / /* This below procedure is giving me error PLS-00801: internal error [*** ASSERT at file pdw4.c, line 2076; Type 0x0x2a97373090 has no MAP method.; DOMAIN_ALL__ADHAS__P__318160[16, 1]] */ CREATE OR REPLACE PROCEDURE domain_all (domain_out OUT t_domain_tab) AS acc_lst array_element; domain_lst t_domain_tab; BEGIN domain_out := t_domain_tab (t_domain_obj (NULL, NULL, NULL, NULL, NULL)); SELECT acc_no BULK COLLECT INTO acc_lst FROM t_acc; FOR i IN 1 .. acc_lst.LAST LOOP domain (acc_lst (i), domain_lst); -- I need to append the data to the excisting collection domain_out := domain_out MULTISET UNION domain_lst; END LOOP; END; / /* --To display all from the table DECLARE domain_lst t_domain_tab; BEGIN domain_all(domain_lst); IF domain_lst IS NOT NULL THEN FOR i IN 1 .. domain_lst.LAST LOOP DBMS_OUTPUT.put_line ('account_id : ' || domain_lst (i).account_id); DBMS_OUTPUT.put_line ('org_id : ' || domain_lst (i).org_id); DBMS_OUTPUT.put_line ('org_name : ' || domain_lst (i).org_name); DBMS_OUTPUT.put_line ('org_role : ' || domain_lst (i).org_role); DBMS_OUTPUT.put_line('associated_id : '|| domain_lst (i).associated_id); END LOOP; END IF; END; */
AlenAlendhas wrote:
Thanks michael, but I am using oracle 10 g, if I use
domain_out: = domain_out multiset union domain_lst
its me gives error.So what stops you to create map method as suggested by William Robertson (I'll assume character CHR (0) may not be present in the t_domain_obj ob object attributes):
SQL> select * from v$version 2 / BANNER ---------------------------------------------------------------- Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod PL/SQL Release 10.2.0.4.0 - Production CORE 10.2.0.4.0 Production TNS for 32-bit Windows: Version 10.2.0.4.0 - Production NLSRTL Version 10.2.0.4.0 - Production SQL> CREATE OR REPLACE TYPE t_domain_obj 2 AS 3 OBJECT ( 4 account_id varchar2 (60), 5 org_id varchar2 (60), 6 org_name varchar2 (100), 7 org_role number, 8 associated_id varchar2 (60), 9 MAP MEMBER FUNCTION weight 10 RETURN VARCHAR2 11 ) 12 / Type created. SQL> CREATE OR REPLACE TYPE BODY t_domain_obj 2 AS 3 MAP MEMBER FUNCTION weight 4 RETURN VARCHAR2 5 IS 6 BEGIN 7 RETURN CHR(0) || account_id || CHR(0) || org_id || CHR(0) || org_name || CHR(0) || org_role || CHR(0) || associated_id || CHR(0); 8 END; 9 END; 10 / Type body created. SQL> CREATE OR REPLACE TYPE t_domain_tab IS TABLE OF t_domain_obj 2 / Type created. SQL> CREATE OR REPLACE TYPE array_element AS TABLE OF number; 2 / Type created. SQL> CREATE TABLE t_acc( 2 acc_no number 3 ) 4 / Table created. SQL> INSERT INTO t_acc (acc_no) 2 VALUES(1) 3 / 1 row created. SQL> INSERT INTO t_acc (acc_no) 2 VALUES(2) 3 / 1 row created. SQL> CREATE TABLE t_domain ( 2 account_id varchar2 (60), 3 org_id varchar2 (60), 4 org_name varchar2 (100), 5 org_role number, 6 associated_id varchar2 (60) 7 ) 8 / Table created. SQL> INSERT INTO t_domain 2 ( 3 account_id, org_id, org_name, org_role, associated_id 4 ) 5 VALUES('1', '2', 'ORGID_1', 1, 'SUP_1') 6 / 1 row created. SQL> INSERT INTO t_domain 2 ( 3 account_id, org_id, org_name, org_role, associated_id 4 ) 5 VALUES('1', '2', 'ORGID_1', 3, NULL) 6 / 1 row created. SQL> INSERT INTO t_domain 2 ( 3 account_id, org_id, org_name, org_role, associated_id 4 ) 5 VALUES('1', '3', 'ORGID_1', 1, 'SUP_1') 6 / 1 row created. SQL> INSERT INTO t_domain 2 ( 3 account_id, org_id, org_name, org_role, associated_id 4 ) 5 VALUES('2', '1', 'ORG_2', 1, NULL) 6 / 1 row created. SQL> CREATE OR REPLACE PROCEDURE domain (accid IN number, 2 domain_out OUT t_domain_tab 3 ) 4 AS 5 BEGIN 6 SELECT t_domain_obj (account_id, org_id, org_name, org_role, associated_id 7 ) 8 BULK COLLECT INTO domain_out 9 FROM t_domain 10 WHERE account_id = accid; 11 END; 12 / Procedure created. SQL> CREATE OR REPLACE PROCEDURE domain_all (domain_out OUT t_domain_tab) 2 AS 3 acc_lst array_element; 4 domain_lst t_domain_tab; 5 BEGIN 6 domain_out := t_domain_tab (t_domain_obj (NULL, NULL, NULL, NULL, NULL)); 7 8 SELECT acc_no 9 BULK COLLECT INTO acc_lst 10 FROM t_acc; 11 12 FOR i IN 1 .. acc_lst.LAST 13 LOOP 14 domain (acc_lst (i), domain_lst); 15 -- I need to append the data to the excisting collection 16 17 domain_out := domain_out MULTISET UNION domain_lst; 18 END LOOP; 19 END; 20 / Procedure created. SQL> DECLARE 2 domain_lst t_domain_tab; 3 BEGIN 4 domain_all(domain_lst); 5 6 IF domain_lst IS NOT NULL 7 THEN 8 FOR i IN 1 .. domain_lst.LAST 9 LOOP 10 DBMS_OUTPUT.put_line ('account_id : ' || domain_lst (i).account_id); 11 DBMS_OUTPUT.put_line ('org_id : ' || domain_lst (i).org_id); 12 DBMS_OUTPUT.put_line ('org_name : ' || domain_lst (i).org_name); 13 DBMS_OUTPUT.put_line ('org_role : ' || domain_lst (i).org_role); 14 DBMS_OUTPUT.put_line('associated_id : '|| domain_lst (i).associated_id); 15 END LOOP; 16 END IF; 17 END; 18 / account_id : org_id : org_name : org_role : associated_id : account_id : 1 org_id : 2 org_name : ORGID_1 org_role : 1 associated_id : SUP_1 account_id : 1 org_id : 2 org_name : ORGID_1 org_role : 3 associated_id : account_id : 1 org_id : 3 org_name : ORGID_1 org_role : 1 associated_id : SUP_1 account_id : 2 org_id : 1 org_name : ORG_2 org_role : 1 associated_id : PL/SQL procedure successfully completed. SQL>
SY.
-
I have problems of filling of a collection.
I created my collection on page load of the Page 7 for help
The user then clicks on the "Copy" button that brings them to the Page 13.BEGIN apex_collection.create_or_truncate_collection (p_collection_name => 'PEOPLE'); END;
That's where I'm trying to complete my collection, by clicking on the link add to the report of the population.
Once added, the Member of the collection should appear in the report of the full Collection.for x in (select * from gus_people_2 where id = :P13_ID) loop apex_collection.add_member(p_collection_name => 'PEOPLE', p_c001 => x.id, p_c002 => x.rank, p_c003 => x.first_name, p_c004 => x.surname, p_c005 => x.dob, p_c006 => x.job, p_c007 => x.disp_seq); end loop;
I use Apex 4.1 on the Oracle websiteselect c001, c002, c003, c004, c005, c006, c007, 'Remove' remove from apex_collections where collection_name = 'PEOPLE'
http://Apex.Oracle.com/pls/Apex/f?p=4550:1:0:
Workspace: GUSCRIGHTON
Username: ANGUS. [email protected]
Password: terminator
Application name: EXCEL_UPDATE_TEST
Same username and password as described above.
It's probably something really obvious, but I can't place it today.
Any help appreciated.
GusHi gUS,.
Now, run your page, it will work.
Thank you
LogaAdd the collection process
Ask = exp1
'ADD' - removed single quotesRemove the collection process
Ask = exp1
DEL - I gave this string.
You will add later with link or a button.Published by: Logaa on May 18, 2012 06:04
-
How to add the column to Adobe flex mxml or actionsctpt mx:DataGrid?
I have the simple mxml code
<mx:DataGrid id="DGG"
editable="true">
<mx:dataProvider>
<mx:Object scheduledDate="4/1/2006"/>
</mx:dataProvider>
</mx:DataGrid>
<mx:Button id="SetBut"
label="Set Array as Data Provider"
click="SetDP(); AddBut.visible = true;"
x="100.5"
y="164"
width="211"/>
<mx:Button id="AddBut"
label="Add a column!"
click="AddCol();"
x="100.5"
y="194"
width="211"
visible="false"/>
<mx:Script>
<![CDATA[
import mx.controls.dataGridClasses.DataGridColumn;
import mx.collections.ArrayCollection;
[Bindable]
public var MyAC:ArrayCollection=new ArrayCollection([{scheduledDate: "4/1/2006", homeTeam: "Chester Bucks"}]);
public function SetDP():void
{
DGG.dataProvider=MyAC
}
public function AddCol():void
{
MyAC.addItem({scheduledDate: "4/5/2007", homeTeam: "Long Valley Hitters", Umpire: "Amanda Hugenkis"});
DGG.columns.push(new DataGridColumn("Umpire"));
}
]]>
</mx:Script>I want to add lines to my datagrid table how do such thing?
How to add the column to Adobe flex mxml or actionsctpt mx:DataGrid?
(You can place this code in a Flash or AIR application - it compiles without error, but will not add any columns =)
Change this:
public void SetDP (): void
{
DGG.dataProvider = MyAC
MyAC.addItem ({scheduledDate: "05/04/2007", homeTeam: "long hitters Valley", umpire: "Amanda Hugenkis"});
}
public void AddCol (): void
{
var dgc:DataGridColumn = new DataGridColumn ("Umpire");
var ca:Array = DGG.columns;
CA.push (DGC);
DGG.columns = ca;
}Dany
-
Can I add a column 'To' in the message lists?
Looking at items, I want to add a column 'To' in the list of messages, so I can see that they have been sent to, but I don't see that option anywhere. Is this possible?
Click with the right button on the headers, or click on the little thing on the end.
-
Can I add the column to the playlist to my music list in itunes?
I consult my entire list of music, and I'd like to know what category of playlist I created that the song is in. Can I add the column to the playlist to my music list?
I use an older iTunes. You cannot create a column for playlists, but you can right click on individual tracks and is one of the elements to display the items in the lists of reading in which it is contained.
-
All-
I have my data (20 columns of ~ 700 000 lines) stored in a binary file and I would like to add a timestamp to each row of data. I intend to use the sampling with the number of samples to add the time at which the sample was recorded in data. I have read the data (~ 700 000 samples) and use a grand for a table 1 d with the same number of rows of data and then insert the 1 column in the largest table that has my data. However, this seems to take a lot of time and I am looking for a faster/more simpler way. Significant NY, I mean the vi works for about 20 min before me give up and stop it. I posted a PNG of the block diagram. Any help will be much appreciated.
Thank you
Chris
Hi humada,.
Try this...
-
With CVI SQL Toolkit, how to add the new variable param column in a table.
Dear all:
I used the CVI Sql toolkit to create a database, but now I don't know how to add a new column to a table in variable param.
I know, to add a column with the name of constant column could be down by below:
DBImmediateSQL ((hdbc, "alter table table1 add column1 char [100]");
But if Column1 is a param variablae how can I write the code? Please advise? It will be appreciated if you could give me an example.
Best regards!
HI -.
If you look at the parameters that you pass to the SQL function, you can see that the second parameter is a string constant. In your code, you can create an array of characters (string). You can then use sprintf to programmatically determine what will be the contents of this variable. In the function call, you can put the variable instead of the literal string, and you will have a customizable SQL statement.
Hope this helps-
John M
-
Classic report - add the column "select box"?
I have a classic report and you want to add a column with a check box so that the user can select several lines and perform an action on all of the lines (delete selected, for example). Looks like it should be easy and maybe integrated features, but I don't find it. Is there a standard way to do this?
Steve
APEX 5.0
Hello
to add a box to your classic report using apex_item.checkbox like this API function:
select APEX_ITEM.CHECKBOX(p_idx=>1, p_value=>DEPTNO) as select_dept, DEPTNO as DEPTNO, DNAME as DNAME, LOC as LOC from DEPT
You can access the values checked (for example in a process page)
declare v_deleted_depts number := 0; begin FOR i in 1..APEX_APPLICATION.G_F01.count LOOP v_deleted_depts := v_deleted_depts + 1; delete from dept where deptno = APEX_APPLICATION.G_F01(i); END LOOP; :P1_DEPTCOUNT := v_deleted_depts; end;
P1_DEPTCOUNT (hidden) is just for later interaction with this procedure - for example, you want to present your users with a message of success and error custom as "Deleted & P1_DEPTCOUNT. departments. »
Maybe you would like to add an option to check all checkboxes at once. If so, read this blogpost Blog of Carl Backstrom: September 2007.
Kind regards
Pavel
Edit: don't forget to toggle the leak key for special characters not your column "checkbox.
-
How to add the new column to a specific position
Hello
My table looks like Fallows.
Select * from company
PRODUCT_ID COMPANY_ID COMPANY_SHORT_NAME COMPANY_LONG_NAME 1 1001 An Inc. Long name A Inc. 1 1002 B Inc. Long name B Inc. 1 1003 C Inc. Long name C Inc. 2 1004 D Inc. Long name D Inc. 2 1005 E Inc. Long name E Inc. 2 1006 F Inc. Long name F Inc. My requirement is I would LIKE to add A NEW COLUMN AS COMPANY_LOCATION NEXT TO COMPANY_SHORT_NAME
How to get there.
I tried like Fallows alter company table add company_location varchar2 (100) after company_short_name;
but this query shows the error
ORA-01735: invalid option of ALTER TABLE
If the query I've tried is correct?
Give me your suggestions.
Thanks in advance.
As long as you're on 11 GR 2 or lower, it will not work.
There is no Clause "AFTER"in the alter table do not add column."
You have the chance to use dbms_redefinition (when no interruption of service is possible) or manually create a new table with the columns in the order you need and then migrate the data and then drop the original and rename a new.
In case you are already on 12 c, you have a chance to add the column to the end and then make visible columns and invisible status in the right order. This way your column will get to the position that you want it to be.
Kind regards
Carsten
-
Auto Add to the Collection of a specific library (Android)?
All the:
I'm looking for a method to automatiquementala images in Lightroom Mobile on my phone in a Collection.
I see how to activate the automatiquementala function in the collection, but he wants to add the Gallery of the camera, which is not what I want to do. I want to be able to move an image in a specific Gallery on my phone and have then Lightroom Mobile automatically add to the collection. Is this possible?
Thank you
Roger
Hey RogerToliver,
This is what I understand you may have concerning: a way to Auto Add a feature for a specific collection to add photos from a specific album / Gallery from your phone every time you add a photo in this album/Gallery of phone.
If I'm wrong in summarizing your characteristic question, the answer would be no. Mobile of Lightroom doesn't have a way to do it right now. But if this is a feature you want, I would suggest showing the site of Lightroom comments so that other mobile users you can comment and/or upvote for engineers to consider.
Photoshop Lightroom | Community customer Photoshop family
Let us know if that answered your question. Thank you.
Melissa
-
Add the value of column based on a different line with the same id
Hello world
I have a query that displays the first three columns of the table below. I would like to add a column to this output, most indicating (for each row) if there is an electronic product in the same order. For example, the command 1 in the table below contains 1 unit of furniture and 1 unit of electronics. In my outings, I would add a flag 'Y' for the two rows 1 and 3. Also, I would add a "N" indicator to any order which does contain all the electronics.
Any ideas on how to achieve this? Any idea or suggestion is appreciated!
order_id product_cat quantity with_electronics 1 furniture 1 THERE 2 grocery 1 N 1 Electronics 1 THERE Thank you
Zsolt
Hi, Zsolt,
You can also use analytical functions. For example:
SELECT order_id, product_cat, quantity
MAX (CASE
WHEN product_cat = 'electronics '.
THEN 'Y '.
ANOTHER "N".
END
) OVER (PARTITION BY order_id) AS with_electronics
Orders
;
Of course, I can't test it without a table.
-
How to add the new column in existing table to our desired location?
How to add the new column in existing table to our desired location?
For example, I have to add the new column 'course' before the salary column in the emp table.
I think the best way is to add the column at the end of the table and create a new view with the order of the columns...
Another option...
places the data into a temporary table and recreate the table with the correct order of the columns, and then insert data to the table from the temporary table
Refer
Add column (from table) in the desired position
Example:
CREATE TABLE temp_my_user LIKE)
SELECT * FROM password);
DROP TABLE password;
(Password) CREATE TABLE
userID NUMBER
, first name VARCAHR2 (25)
, middleInitial VARCHAR2 (1)
(, name VARCHAR2 (25));
INSERT INTO password (userID, firstName, lastName)
(SELECT username
first name
lastName
OF temp_my_user);
DROP TABLE temp_user;
-
Hi, I would do the following:
In a specification of Prodcut-> tab related specifications, I would like to add a column on the section of the Alternative standards. Currently, the section shows # Spec and Spec - I want to add a column for the classification.
I looked through some of the extensibility documentation, but didn't notice anything to do something like that (it's probably there somewhere and I just lack). Can you please give me an example or point me in the right direction on this?
Thank you
Hi Mike,.
We currently have is not an extension of available column add new columns to this section. Feel free to save a value for this application.
However, you can add the collation of the column name of the technique, if you wish. To do this, you must create an extension of FormatPlugin by using the AltGlobalStandardIdentityPlugin extension point. Your plugin would return the classification (and if you want that the State continue to be displayed, which also include).
See the PluginExtensions in the ExtensibilityPack in the ReferenceImplementations\PluginExtensions\Documentation folder and read the hardware section identity Plugins and the section called create and deploy a new Format Plugin. This will also guide a simple reference implementation. You can also see the complete source code in the ReferenceImplementations\PluginExtensions\SourceCode\ReferencePlugins\ folder. This Visual Studio contains example FormatPlugins for you to review.
You will need determine if the classification should also appear on the printing specifications. If Yes, then this is just additional method (and interface) to implement, but documentation shows that.
Kind regards
Ron
-
How to add the action button for each column in the interactive report
Hi all
I'm new in APEX, so pls forgive my question, if it's simple, but I am struggling with this problem for days now. I have interactive report and you want to add button in each row. What I want to do with this button is the following:
1. to execute some stored procedure in need of that particular line item values
2. returns a (id)
3. go in another page in the application by passing the value out of the procedure (id).
and I'm not find the way to do it. I tried now means:
1. If I add the link of the column, so I can refer to the value of the current row, I don't know how to call the stored procedure and perform actions of rest I need
2. If I add the button to the region, I do not know how to reference the values in column of a particular line of the interactive report...
and I'm stuck...
I just forms and global report and probably still think the "wrong" way .
Any help would be appreciated!
Thank you!!!
user3253917 wrote:
Please update your forum profile with a real handle instead of 'user3253917 '.
I request of the company: there is a customer who always orders the same standard product orders (always order the same products, fair amount is different). I want to make it simple for the user: instead of retyping the command (master and few records details every time yet) I want to copy selected command (copy of the master record and record details) so that the user will only change date order (in master record) and amount fields in record details).
So, in order to give him:
1. the user must be able to choose the order in which I would copy (at page 4), select it,
2. I need to make PL/SQL procedure to insert the new master record (order) and a few record details (order_items) (copy of the order/order_items chosen in step 1)
3. navigate the user to page 29, where the master account at stage 2 insterted appears, so that the user can change the date and quantities.
Any solution will be highly appreciated! Thank you very much!!!
In simple terms:
- Add a link to column "Command copies" in the report on page 4, which sets the COPY request and passes the order ID on page 29.
- On page 29, create a process before header, sequenced to be the first process executed and conditional on REQUEST be EXEMPLARY, which creates a new order as a copy of the order with the ID from page 4 and returns the ID of the new order in the PK command ID of 29 page element.
Maybe you are looking for
-
The best of YAHOO. on Firefox extension - nag screen
The issue began a couple of weeks. When I visit the Yahoo! News (news.yahoo.com) website, I get a nag screen to install an extension called the best of YAHOO. on Firefox. I don't want to install the extension, so I have to click Cancel to continue. T
-
Possible to move the Pavilion DV5 hard drive to the newer model?
Hello. I have a little old (but LARGE) laptop - DV5 - 1133ca (FS036UA@ABC) that has intermittent problems with the display. It blinks and goes sometimes totally blank. Then I plug in an external monitor and continue to work. A few days later, he ca
-
Icon does not not in 10 BlackBerry app using WebWorks 2.0.0.54
Hello! I'm porting an application from Android BlackBerry 10, resulting in extremely easy when I discovered that the new SDK was released. The only problem I found was that the icon has not changed when I wrote this line in the config.xml file: From
-
Although the value, I can not phone ring and vibrate as the default value for all calls. I can put individual to vibrate and ring contacts and it works but I want as the default for all incoming calls. Any help would be appreciated, thanks
-
Lightroom 6 [how to uninstall on Win 10?]
Can someone please tell me how to uninstall Lightroom 6 on Windows 10? I need to uninstall and reinstall. I have my license number and was sold as a standalone application.