Help needed on table type datatype.
Hi,
I have written the following code,
declare
type t is table of emp.empno%type index by binary_integer;
y t;
begin
select empno bulk collect into y
from emp where 1 = 1;
dbms_output.put_line(y.count);
exception
when others then
dbms_output.put_line(SQLERRM);
end;
now i want to print the values from the table type variable y. how can i do that.
Regards
Jhansi
You reference record elements using dot notation: record.field
You reference collection elements using parenthesis notation: collection(element)
So you example might work like this:
declare
type t is table of emp.empno%type index by binary_integer;
y t;
begin
select empno bulk collect into y
from emp where 1 = 1;
dbms_output.put_line('count='||y.count);
dbms_output.put_line('Empno in element 1 is '||y(1));
end; a couple of additional comments
When you post code, you can enclose it with the markup tag { code } but without the space between the curly brackets and the key word code
These tags will format everything between them usign a fixed pitch font making it more readable.
try not to use an EXCEPTION WHEN OTHERS
usually, you don't want to trap and handle ANY exception.
If there is a specific exception that you want to trap and handle in your code put that handler in your code, otherwise let and exception propagate up to your SQLPlus or SQLDeveloper calling program.
Similar Messages
-
Need help for record/table type
Hi, All,
I have a table below and I need to use a procedure/function to return a list of values out and use anther procedure (array with multiple values in) to update the database. Could someone please give some examples?
Here are my questions:
1. I need to create a user_defined_type to hold the list of info (array like, with more fields). Does the table type with %rowtype do that? If not, Could you please give an example?
2. if I do
SELECT * INTO V_test(1) FROM PREO_profile
where user_id = '1';
can the 3 records of user_id 1 all be selected in the V_test table? If not, could you please tell me what to do?
Thanks a lot.
PREO_profile:
User_id N_id M_id
1 11 111
1 22 222
1 33 333
2 11 111
2 22 222
2 33 333
CREATE OR REPLACE PROCEDURE test_updatePro
(user_id in varchar2,
profile_info out T_Test)AS
Type T_Test is table of PREO_profile%rowtype
index by binary_integer;
V_test T_Test;
BEGIN
SELECT * INTO V_test(1) FROM PREO_profile
where user_id = '1';
END;Here is one approach. This works in 9iR2. It's worth noting this functionality is evolving quite fast. Consequently, stuff that works in 9.2 may well not work in 9.0.1 and can probably be done much neater in 10g.
Let's start by creating some tables....
SQL> CREATE TABLE preo (user_id NUMBER, m_id NUMBER, n_id NUMBER);
Table created.
SQL> INSERT INTO preo VALUES (1, 11, 111);
1 row created.
SQL> INSERT INTO preo VALUES (1, 22, 222);
1 row created.
SQL> INSERT INTO preo VALUES (1, 33, 333);
1 row created.
SQL> INSERT INTO preo VALUES (2, 11, 111);
1 row created.
SQL> INSERT INTO preo VALUES (2, 22, 222);
1 row created.
SQL> INSERT INTO preo VALUES (2, 33, 333);
1 row created.
SQL> CREATE TABLE neo_preo AS SELECT * FROM preo WHERE 1=0;
Table created.
SQL> We'll need some types we need for communicating between processes....
SQL> CREATE OR REPLACE TYPE preo_t AS OBJECT (u_id NUMBER, n_id NUMBER, m_id NUMBER);
2 /
Type created.
SQL> CREATE OR REPLACE TYPE preo_nt IS TABLE OF preo_t;
2 /
Type created.
SQL> Here are methods to populate an array (actually a nested table)....
SQL> CREATE OR REPLACE FUNCTION get_preo (p_uid IN NUMBER) RETURN preo_nt
2 AS
3 return_value preo_nt := preo_nt();
4 BEGIN
5 SELECT preo_t(user_id, n_id, m_id)
6 BULK COLLECT INTO return_value
7 FROM preo
8 WHERE user_id = p_uid;
9 RETURN return_value;
10 END;
11 /
Function created.
SQL>... and consume that array....
SQL> CREATE OR REPLACE PROCEDURE ins_neo_preo (p_newrows IN preo_nt)
2 AS
3 BEGIN
4 INSERT INTO neo_preo
5 SELECT * FROM TABLE(CAST(p_newrows AS preo_nt));
6 END;
7 /
Procedure created.
SQL> So now we're ready to rock!
SQL> DECLARE
2 nt preo_nt;
3 BEGIN
4 nt := get_preo(1);
5 ins_neo_preo(nt);
6 END;
7 /
PL/SQL procedure successfully completed.
SQL>
SQL> SELECT * FROM neo_preo
2 /
USER_ID M_ID N_ID
1 111 11
1 222 22
1 333 33
SQL> A little bit of limbo, a little bit of samba!
Cheers, APC -
Information on table type datatypes.
Hi,
I am working with the table type composite datatype. After I insert the values to the table type declared variable how will I be able to print that or use it in further DML operations.
example
create or replace procedure xxx_proc as
type u_rec is record
empno number(5),
ename varchar2(10));
type m_tbl is table of u_rec index by binary_integer;
cursor c1 is select empno, ename from scott.emp;
nokia m_tbl;
motorola u_rec;
i number:=0;
begin
for j in c1 loop
fetch c1 into motorola;
i := i+1;
nokia(i) := motorola;
end loop;
dbms_output.put_line(nokia.first);
dbms_output.put_line(nokia.last);
dbms_output.put_line(nokia(2));
end;
I execute this proecedure it returns error at 19, how will I print the values.
Regards
Jhansi.You are driving me crazy
y.empno(i) := i;This should be...
y(i).empno := i;
SQL> declare
2 type xx is table of emp%rowtype index by binary_integer;
3 y xx;
4 i number :=0;
5 begin
6 for j in 1..20 loop
7 i := i+j;
8 y(i).empno := i;
9 y(i).ename := 'Mark';
10 y(i).job := 'Clerk';
11 y(i).mgr := i+5;
12 y(i).hiredate := sysdate;
13 y(i).sal := i* 100;
14 y(i).comm := i*10;
15 y(i).deptno := 10;
16 end loop;
17
18 dbms_output.put_line('20 records inserted successfully');
19 end;
20 /
20 records inserted successfully
PL/SQL procedure successfully completed.It works but i have no clue what in the world are you trying to do ;)
Edited by: Karthick_Arp on Feb 18, 2009 9:19 PM -
Help needed with tables in iWork pages
Hi,
When I have a table in microsoft word I can fill it with all the content I like and it will run on page to page.
In Pages however, a row (along with the rest of the table below) will split off and start on the next page if threre is too much content.
If the contents runs over a whole page the text will run on into nowhere, so off the page and the subsquent empty cells will start on the next page.
How do I stop this from happening?
ThanksThat is the way tables in Pages works. It doesn't work as in Word. Do you really need using tables? I myself find it a bad habit when using a table for every thing.
-
Help needed in data type casting
I have a java program which will receive data and its type in the String format. During program execution, the data in the String data has to be converted into the respective data type and assigned to a variable of that data type so that it could be used in the program. Programmer may not know the type of data that the value has to be converted into.
I really got struck up with this. This is a RMI application and one process node is sending the data to another node in the String format and the type of data it should get converted into so that it can be converted into the respective type and used for computation.
Can you understand what I am asking for ....if you can pls help and it is highly appreciatedI dont know whether i ahve expressed it correctly
look at this code
dataPacket sendtoNode = send.senDatatoNode(inputReq);
String recnodnum = sendtoNode.nodeNum;
String recvarnum = sendtoNode.varNum;
String recvartype = sendtoNode.dataType;
String recvalvalue = sendtoNode.dataVal;
int num; int type;
double result;
// here in this case the result variable type is double
if (recvartype.equals("int")){
type = 1;
result = Integer.parseInt(recvalvalue); will pose problem
else
if (recvartype.equals("double")){
type = 2;
result = Double.parseDouble(recvalvalue);
else
if(recvartype.equals("float")){
type =3;
result = Float.parseFloat(recvalvalue); will pose problem
else
if(recvartype.equals("Boolean")){
if ((recvalvalue.equals("true")) || (recvalvalue.equals("TRUE")))
type = 4;
result = Boolean.parseBoolean(recvalvalue); will pose problem
else
if(recvartype.equals("char")){
type = 5;
result = (char)recvalvalue; will pose problem
else
if(recvartype.equals("String")){
type = 6;
result = recvalvalue; will pose problem
else
if(recvartype.equals("byte")){
type = 7;
result = Byte.parseByte(recvalvalue); will pose problem
else
if(recvartype.equals("long")){
type = 8;
result = Long.parseLong(recvalvalue); will pose problem
else
if(recvartype.equals("short")){
type = 9;
result = Short.parseShort(recvalvalue); will pose problem
//forvarval varvalue = new forvarval();
//varvalue.forvarval(recvartype, recvalvalue);
// this has to be done after sorting the problem of type casting string result = recvalvalue;
//result = value; //<this will surely give me a problem as i m assigning string to double>??
send.host(result);
System.out.println("result received and the result is " +recvalvalue );
now i need to assign the converted string in to a variable and use in the compuation ..thts where the challenge n not in teh conversion process... -
Help needed for User-Defined Datatype
Hi All,
I have one table which has User-defined Column Datatype.
Now Client wants us to rename the User-Defined Datatype for some Standardization process.
How to do rename of it, coz Rename old to new doesnt work in Oracle 10.2.0.4G for TYPES.
So we re-created it with the new names. Now our Problem is how do i re-assign the column datatype with the New User-Defined DataType.
Regards,
PrathameshThe Only Solution that i could found was - Create a new column with new User-Defined Datatype, copy the old column values to New Column, then drop the old column and rename the new Column to Old Column
ORA-22859: invalid modification of columns
Cause: An attempt was made to modify an object, REF, VARRAY, nested table, or LOB column type.
Action: Create a new column of the desired type and copy the current column data to the new type using the appropriate type constructor. -
Help needed in table maintenance
Dear all
I have to add a few fields in existing Z-table. When I try to add a field to the table, I get an error that
Table <table name> is too long (>1962). Can any one guide what's the meaning of this and how to correct the same.
Thanks in advance. Points for sure.
Regards
DineshHi,
The total field lengths of the data elements used in your table is more than 1962, which is the max permissible limit.
Reduce the length of some of the text fields which you feel is extra and then embed your new field,
This should solve your problem.
Hope this helps!!!
regards,
Lalit Kabra -
Hi guys,
I am new to dialog programming , I have the following requirement in table control.
I have to be displayed 4 fields in Table control
1. Mara-MATNR (Match code)
2.Mara-BISMT
3. Mara-MATKL
4. Makt-MAKTX
Based on Material number the rest of the fields to be displayed automatically.
If possible send the sample code for the above requirement.
Thanks & Regards
RajHi,
Create a screen and create those fields in that screen with proper data element type.
in the PAI event, create a Module like MODULE_FILL_DATA. and double click on that one, in that module write this code
IF MATNR IS INITIAL.
Write the Error like please enter the material No
ELSE.
Select BISMT MATKL MAKTX into those screen field from MARA where
MARA = Screenfield-MATNR.
ENDIF.
that's it, and when you run the screen enter the material no and press enter, then all the fields will come over there
Regards
Sudheer -
Help needed on table view popup
I have created custom popup(table view) and able to display the data in the same.
I have created the button(BT108H_LEA/LeadOVViewSet) in the toolbar in lead overview screen in web ui and when I clicks the button popup is triggering.
I want to transfer the selected record from popup to products assignment block in the overview.
Please help me how to transfer the data from popup to products.
What I did:
1. I have created the custom view(popup view) and context node in the component BT108H_LEA.
2. Created the new window (pop window)and embed the popup view in the runtime repository.
3. Added in the interface view as pop window.
4. Created Component Usages with the popup window.
5. Triggering the popup when the user clicks the button and populating the data in the popup in DO_PREPARE_OUTPUT method of custom view(popup view).
6. Now I want to transfer the data from popup to products assignment block.
Example: popup data
item product
10 Mat100
If I select row from the above popup how to fill the data in the below component(view).
Products assignment block in the lead.
item product qty UOM description
Thanks,
VenkatYou would have to use the outbound plugs to transfer data from your component to the other component. Here you have a parameter IV_DATA_COLLECTION. Fill the entries you want to fill here.
Check the Sold to Party pop up while creating Quotation for Sales cycle when you log in with SALESPRO.
Regards
Kavindra
Edited by: joshi_kavindra on Nov 23, 2011 5:03 PM -
Help needed in Table in Table Approach using OAF
We have a requirement in OAF wherein the results region of search page should give header details. And in header details there is a show and hide button which would show all the line details corresponding to the header (like Table – in – Table).
For Header details I have used advanced table under that I have used detail region and there I have created advanced table for line details.
I have also created view link to link the header details view object and line details view object.
In Process Request method of the controller I have set view link name and child attribute name for both outer table (header details table) and inner table (line details table)
When I run the OAF page, I am getting the below error. I am facing this error when I tried to set the view link name and child attribute of inner table (i.e. line details table) in the controller.
Detail 0 ##
java.lang.NullPointerException
at oracle.apps.fnd.framework.webui.OAAdvancedTableHelper.updateInnerTableProperties(Unknown Source)
at oracle.apps.fnd.framework.webui.OAAdvancedTableHelper.processRequestAfterController(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanTableHelper.processRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAAdvancedTableHelper.processRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.table.OAAdvancedTableBean.processRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.layout.OAFlowLayoutBean.processRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanTableHelper.processRequest(Unknown Source)Hi,
read the response above. This is the wrong forum.
try OA Framework
Frank -
Help needed regarding table layouting Issue in CS4
I was trying to layout a table using an Indesign custom script in CS4. The input to the Indesign is a XML file
Please find below the snapshot of the XML file with the table definition:
<Table xmlns="http://ns.adobe.com/AdobeInDesign/5.0/" aid5:tablestyle="_XXY" aid:tcols="6" aid:trows="17"><Cell xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid5:cellstyle="_XYY" aid:ccols="1" aid:crows="1" aid5:tablestyle="_XXY">
Now when the table is layouting it is not taking into account the style of the table nor that of the cell.
Can you please suggest what is the best way of defining the table styles and the cell styles so that the table can be laid out in Indesign with the proper table styles and the cell styles.Please post in the ID forum.
-
Help needed in Table and field
Hi all,
can any one tell me the table and field to get basic unit of measure and unit of issue.
I guess both are different.
ThanksFor base unit of measure, uom, T006 is the main table.But whereever you have a quantity yu will find UOM in that table. The field is MEINS.
when you say unit of issue, you mean actual unit of measure right?
In that case it again depends on what you are looking at. Example
in table LIPS there is base UOM and Actual UOM.
base is always "MEINS" and actual is "LFIMG" in this case.
So get the table in your functional area and check for the actual uom field in SE11.
Regards
Message was edited by:
Sandeep Bhavsar -
Hi all ,
I have following questions , can someone give me brief details on these
1. What is the meaning of secondary index tables? for example what is the difference between BSIS and BSAS..
Some sample tables for my question are--
u2022 BSID Accounting: Secondary Index for Customers
u2022 BSAD Accounting: Secondary Index for Customers (Cleared Items)
u2022 BSIK Accounting: Secondary Index for Vendors
u2022 BSAK Accounting: Secondary Index for Vendors (Cleared Items)
u2022 BSIS Accounting: Secondary Index for G/L Accounts
u2022 BSAS Accounting: Secondary Index for G/L Accts (Cleared Items)
2. Who is a 1099 vendor? what's the meaning of 1099?
ThanksHello Sairam,
1.The diff between BSIS and BSAS is
BSIS is having all GL open items
BSAS is having all GL cleared items
BSIK is having Vendor open items
BSAK is having Vendor clered items
BSID is having Customer open items
BSAD is having Customer cleared items
thanks
PV -
Suggestions/help needed creating portal type page
Let me start by saying I am very new to Java. I'm trying to create a portal - a fairly simple web page where each user who logs in will see only those application links that they are authorized to access. User A will see links to applications X, Y and Z and user B will see links to applications R and Q.
I'm running a Tomcat 6 server, and will be using Java 6 (jsp pages, servlets, etc). I've done some research on things like tomcat realms, ldap, ad, jaas, etc. but I'm still not sure what direction I should be going in. My 'portal'/web page will consist of about 20 application links - some are links out to external web sites/applications (public web sites outside of our network), some are internal applications housed on various in-house servers on our network, some are home-grown, others are 3rd party applications, eventually some will be home-grown java applications. Each application currently has it's own login and password.
I know that I can build a table in a relational database, or update an xml file in Tomcat and use Tomcat realms to determine who has access to what. Are there other options? I can certainly build a table, but I don't want to if there are easier ways - can AD tell me what applications a particular user has access to (so I can determine what links to display)? If so, how? (I don't know much about ad (yet)).
I just don't want to end up building something overly complex, and missing out on something that would make this simpler. Any ideas, suggestions, etc on what I could/should be looking at would be most appreciated.
Thanks!Unless you know what you're doing with absolute positioning, avoid absolute positioning! Absolute positioning actually takes an element out of the normal HTML document flow and positions it absolutely in relationship with it's first parent with a position other than static - for details read the HTML specs at the W3C.
Ideally you should use the normal HTML document flow. Divs are block level elements meaning that they act like blocks that take up a height (determined by children content) and width (the full width of the page or it's parent container, unless you tell it otherwise).
For your CSS try this:
#techlistcontainer {
width: 75%;
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 30;
padding-top: 0;
padding-right: 0;
padding-bottom: 0;
padding-left: 30;
How does that work with your templates? -
Help Needed on Table View Control
Hi Abapers
In Table View Control which property or system variable keeps the user selected row's row id.
Situation is that user enters many records into sales details table view. Table view contains the fields, productid product no qty discount and rate. Suppose user wants to delete one particular record(sales details) from that table view while entering this sales details .here i want to know which is that particular row that the user selected. Table views which property keeps this row no information. i am very glad if you people give me more information abount table View Controls .
With regards
Anoop.You would have to use the outbound plugs to transfer data from your component to the other component. Here you have a parameter IV_DATA_COLLECTION. Fill the entries you want to fill here.
Check the Sold to Party pop up while creating Quotation for Sales cycle when you log in with SALESPRO.
Regards
Kavindra
Edited by: joshi_kavindra on Nov 23, 2011 5:03 PM
Maybe you are looking for
-
Can I use Airport Extreme instead of an internal Airport Card?
+Sorry I realise there are various queries all over the web relating to this same issue, however I can't seem to find a consensus anywhere, or a setup that specifically relates to my situation...+ I currently have a G5 iMac (OS X 10.5.6), which conne
-
Reset Safari -- Now I Can No Longer Access Secure Sites Or iTunes Store.
Hi, A few days ago I reset Safari (I'm still not sure why... boredom??). Well, now I'm paying for it. Now I can't access secure sites (such as gmail, bank accounts, etc.). in Safari. When trying to access a secure site I get an error window that read
-
Hi I have 3 date fields in my view. what i need is for example My First date field i am selecting 1st January 2008 Second date field i am selecting 10th January 2008 in my third date field calendar should enable only in between that 2 dates.remaining
-
Integrating OIM 9102 with EBS 12.0.6 and using User Management with HR Foundation Connector. while provisioning provided some dummy employee number for employee number and its giving the error and mentioned some default values for Business group id a
-
After the update, the next screen showed all the letters in smaller font, with fewer pixels. All the screens are like that now and I found nothing in the Firefox help contents. This is a problem because I have vision difficulty. So, how can I increas