How to return data using the object type?
Hello all - I have an obligation to return the values object type.
In the same way as
list - Plan1, Subplan1, Fund1, 2 Fund Fund 3
list - Plan2, Subplan2, Fund2
list - plane3, Subplan3, not funds
To achieve this I wrote below proc but its giving as response below which is does not correspond with my requirement. Someone has an idea how to write code to get the list of funds against each plan in each line?
Output:
PDB01. () T_T_CONTRACT
PDB01. T_O_CONTRACT ('p1', 's1', PDB01. T_O_FUND ('p1', 's1', 'f1')),
PDB01. T_O_CONTRACT ('p1', 's1', PDB01. T_O_FUND ('p1', 's1', 'f2')),
PDB01. T_O_CONTRACT ('p1', 's1', PDB01. T_O_FUND ('p1', 's1', 'f3')),
PDB01. T_O_CONTRACT ('p2', 's2', PDB01. T_O_FUND ('p2', 's2', 'f2')),
PDB01. T_O_CONTRACT ('p3', 's3', PDB01. T_O_FUND (NULL, NULL, NULL))
)
DROP TYPE T_T_fund;
create or replace
TYPE T_O_fund
AS OBJECT)
argument plan_id Varchar2 (128).
subplan_id Varchar2 (128).
fund_id Varchar2 (128)
)
No final;
/
create or replace
type T_T_FUND
as the table of T_O_FUND;
/
type of projection T_T_CONTRACT;
create or replace
TYPE T_O_contract
AS OBJECT)
argument plan_id Varchar2 (128).
SUBPLAN_ID varchar2 (128).
ov_fund T_o_fund
)
no final;
/
create or replace
type T_t_contract as the T_O_contract table;
/
-------------------------
/ * Remove T_T_FUND;
DROP TYPE T_O_fund;
type of projection T_T_CONTRACT;
DROP TYPE T_O_contract; * /
----------------
create or replace
procedure test_cursor (o_c1 OUT sys_refcursor) is
V_T_T_FUND T_T_FUND;
v_T_t_contract T_t_contract;
Start
WITH (CONTRACTS AS
SELECT "p1" PLAN_ID, "s1" SUBPLAN_ID FROM DUAL UNION ALL
SELECT "p2" PLAN_ID, 's2' SUBPLAN_ID FROM DUAL UNION ALL
SELECT "p3" PLAN_ID, 's3' SUBPLAN_ID FROM DUAL
),
Fund)
Select "p1" PLAN_ID, SUBPLAN_ID 's1', 'f1' FUND_ID of all the DOUBLE union
Select "p1" PLAN_ID, SUBPLAN_ID 's1', 'f2' FUND_ID of all the DOUBLE union
Select plan_id "p1", "s1" subplan_id argument, "f3" fund_id Union double all the
Select the argument plan_id 'p2', 's2' subplan_id, 'f2' double fund_id
)
Select T_O_contract (c.PLAN_ID, c.SUBPLAN_ID, T_o_FUND (f.PLAN_ID, f.SUBPLAN_ID, f.FUND_ID))
TO COLLECT FEES IN BULK
in v_T_t_contract
c CONTRACTS, FUND F
where C.PLAN_ID = F.PLAN_ID
and c.SUBPLAN_ID = f.SUBPLAN_ID (+);
Open the O_C1 for
SELECT 't' TYP, v_T_t_contract contract_LST
FROM DUAL;
end;
/
impression o_test
You can declare the attribute OV_FUND as T_T_FUND data type:
create or replace type t_o_contract as object ( plan_id varchar2(128) , subplan_id varchar2(128) , ov_fund t_t_fund ); /
You will be able to do this:
with contracts as ( select 'p1' plan_id, 's1' subplan_id from dual union all select 'p2' plan_id, 's2' subplan_id from dual union all select 'p3' plan_id, 's3' subplan_id from dual ), funds as ( select 'p1' plan_id , 's1' subplan_id, 'f1' fund_id from dual union all select 'p1' plan_id , 's1' subplan_id, 'f2' fund_id from dual union all select 'p1' plan_id , 's1' subplan_id, 'f3' fund_id from dual union all select 'p2' plan_id , 's2' subplan_id, 'f2' fund_id from dual ) select t_o_contract( c.plan_id , c.subplan_id , cast( multiset( select t_o_fund(f.plan_id, f.subplan_id, f.fund_id) from funds f where f.plan_id = c.plan_id and f.subplan_id = c.subplan_id ) as t_t_fund ) ) from contracts c ;
Tags: Database
Similar Questions
-
Data Modeler: how to create and use the collection type
Hello
essentially of departure I don't understand how (for example) create and use the data based on the type of data varray type.
Please notify.
Thank you
AndrewHi André,.
You can create new types of collection (varray/table) in two ways:
(1) in the browser - find 'Types of data' > 'Types of Collection' node menu dropdown - there just 'create new collection type' it
(2) in the types of data model diagram - you can create collection "some type structured" or collection of references to the it - use 'new Collection... '. "tool and click first on sight structured type and after the structured type that will contain the collection - new attribute is added to the latter and if there is none this type of collection already didn't set the new collection type are created and you can change it later.Philippe
-
How to extract data using the xml data type
Hello
I tried the following example using the xml data type, but not the desired output.
could you please correct the query in order to obtain the necessary
CREATE TABLE TEST.EMP_DETAIL ( EMPNO NUMBER, ENAME VARCHAR2(32 BYTE), EMPDETAILS SYS.XMLTYPE )
I need to get the record for Empid = '2'Insert into EMP_DETAIL (EMPNO, ENAME, EMPDETAILS) Values (7, 'Martin', XMLTYPE('<Dept> <Emp Empid="1"> <EmpName>Kevin</EmpName> <Empno>50</Empno> <DOJ>20092008</DOJ> <Grade>E3</Grade> <Sal>3000</Sal> </Emp> <Emp Empid="2"> <EmpName>Coster</EmpName> <Empno>60</Empno> <DOJ>01092008</DOJ> <Grade>E1</Grade> <Sal>1000</Sal> </Emp> <Emp Empid="3"> <EmpName>Samuel</EmpName> <Empno>70</Empno> <DOJ>10052008</DOJ> <Grade>E2</Grade> <Sal>2530</Sal> </Emp> <Emp Empid="4"> <EmpName>Dev</EmpName> <Empno>80</Empno> <DOJ>10032007</DOJ> <Grade>E2</Grade> <Sal>1200</Sal> </Emp> </Dept> '));
Then tried the following query with no expected o/p
Thank you...SELECT a.empno,a.ename,a.empdetails.extract('//Dept/Emp/EmpName/text()').getStringVal() AS "EmpNAME", a.empdetails.extract('//Dept/Emp/Empno/text()').getStringVal() AS "EMPNumber", a.empdetails.extract('//Dept/Emp/DOJ/text()').getStringVal() AS "DOJ", a.empdetails.extract('//Dept/Emp/Grade/text()').getStringVal() AS "Grade", a.empdetails.extract('//Dept/Emp/Sal/text()').getStringVal() AS "Salary", a.empdetails.extract('//Dept/Emp[@Empid="2"]').getStringVal() AS "ID", a.empdetails.extract('//Dept/Emp[EmpName="Coster"]').getStringVal() AS "CHK" FROM emp_detail a where empno=7 AND a.empdetails.existsNode('//Dept/Emp[@Empid="2"]') =1
Karthick_Arp wrote:
I'm not very good at that... But if your XML code should not be more like thisSQL> Insert into EMP_DETAIL 2 (EMPNO, ENAME, EMPDETAILS) 3 Values 4 (7, 'Martin', XMLTYPE('
5 6 .. cut ..1 7Kevin 850 920092008 10E3 113000 12Why? It is perfectly valid to data as attributes rather than elements and also quite common for key values.
-
How to fill the value in the nested table by using the object type
Hi gurusI created an object type and able to fill the values in it, now I want to create a nested table type of this object and fill it but looks like I'm doing something wrong, see my code below.
Code example
CREATE or REPLACE TYPE countries_o
AS
OBJECT
(
COUNTRY_ID TANK (2 BYTES),
COUNTRY_NAME VARCHAR2 (40 BYTE),
REGION_ID NUMBER);
/create or replace type countries_t is table of the countries_o;
/CREATE OR REPLACE
ABC of the PROCEDURE
IS
v_print countries_t; -: = arr_countries_t('01','Aus',1);
BEGIN
v_print: = countries_t('01','A',11);
DBMS_OUTPUT. Put_line (v_print. COUNTRY_ID | v_print. COUNTRY_NAME | v_print. REGION_ID);
END;
/
Error
- Error (6.3): PL/SQL: statement ignored
- Error (6,12): PLS-00306: wrong number or types of arguments in the call to 'COUNTRIES_T '.
- Error (7.3): PL/SQL: statement ignored
- Error (7.32): PLS-00302: component 'COUNTRY_ID' must be declared
Thanks in advance
Concerning
Muzz
Hi user,
Here is another method that you can try-
CREATE OR REPLACE
ABC of the PROCEDURE
IS
v_print countries_t: = countries_t (countries_o('01','A',11));
BEGIN
DBMS_OUTPUT. Put_line (v_print (1).) COUNTRY_ID | v_print (1). COUNTRY_NAME | v_print (1). REGION_ID); -you're accessinf the first element of the nested table, which in turn points to the object.
END;
In the sections of the declaration you have assigned values to the nested table.
Kind regards
Maxou - Error (6.3): PL/SQL: statement ignored
-
How to select data using the same remote database column name 3
Hello
Can anyone help me on how to get the data with the same remote database column names 3 and a unique nickname.
E.g.
SELECT *.
B.SID, b.status, SUM (b.qty) qantity MAX (b.) date_as_of
Of
* ((table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3) has, *)
(* (table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3) b). *
WHERE b.dept = 'finance '.
AND a.position = "admin".
AND a.latest = 'Y' AND (b.status <>"MLT") AND b.qty > 0;
B.SID GROUP, b.status;
NOTE: the instructions "BOLD" is just an example of what I want to do but I always get an error beacause of ambiguous column.
Thanks to advnce. :)
Published by: user12994685 on 4 January 2011 21:42user12994685 wrote:
Can anyone help me on how to get the data with the same remote database column names 3 and a unique nickname.
Not valid. This makes no sense and breaks all the rules of scope-resolution. And if it is in a single database, or uses tables in databases, is not relevant.
Each object must be particularly well identified. If you cannot do this:
select * from (table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3) a
3 objects cannot share the same alias. Example:
SQL> select * from (dual, dual) d; select * from (dual, dual) d * ERROR at line 1: ORA-00907: missing right parenthesis
You need to combine objects - by using a join union or similar. He will have to be done as follows:
SQL> select * from (select * from dual d1, dual d2) d; select * from (select * from dual d1, dual d2) d * ERROR at line 1: ORA-00918: column ambiguously defined
However, we need to have unique column in a projection of SQL names - so the join of the need to project a unique set of columns. So:
SQL> select * from (select d1.dummy as dummy1, d2.dummy as dummy2 from dual d1, dual d2) d; DUM DUM --- --- X X SQL>
I suggest that you look carefully at what opportunities are and how it applies in SQL - and ignore if the referenced objects are local or remote, because it has no effect on the basic principles of scope-resolution.
-
How many cell data uses the health app?
We have little data plans, and my wife intends to use the health app every day. Should I use to run the cell data health application? Another reference... If I used the maps on the watch application would use this as much data as it normally does on my iPhone? Just try to get an idea of the amount of data from the watch uses. Thank you.
I have not observed the health app using cellular data at all.
Regarding the cards on the watch, it's just an extension of maps on your phone. Cards cannot run independently on the watch. If you use maps on the watch, he uses exactly this use from your phone from your phone is running the show.
-
How to post JSON using the Oracle Data Service remains
I use the regular (not NoSQL or something) oracle database with oracle rest data service. Now I need to post data / put wrote in the body of the request using some json/xml format, how to consume them using the rest data service, searching inside the express application? important: using pl/sql block
Also, I am on,
Data service Oracle rest 3.0
Oracle Application Express 4.2
Post edited by: Jacynthe
OK, I got the answer. At the express request, there is a link called body variable (: body in BLOB). but the BLOB data type. So, we have to convert that in other data, type what we in pl/sql. I've converted data type witch CLOB supports json.
-
On the forms send us and receive in return, data in the form of fields will be not print. We can view the data, but the fields to print Virgin. How can I fix it?
OK, it's different. These text boxes are (at least engineering point of view) not considered form data, they are annotations (or markup). On your print dialogue box, you will see a group of "Comments & Form". Make sure that the first control is set to "Document and annotations:
After this change, you should see the markup of your impressions.
-
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 -
Define a map or ORDER method for the object type
Hi gurus
I created an object and then its type and then I use this object and type based on line, see below:
Create the object
CREATE OR REPLACE
TYPE test_object
IS
OBJECT
(
next_appearance_dt DATE, - next_appearance_dt
youth_adult VARCHAR2 (5) - youth_adult
) ;
/Create the object Type
CREATE or REPLACE TYPE t_docket_object IS TABLE OF THE test_object;
/
Create function Pipeline
FUNCTION to CREATE or REPLACE f_report (p_dt date, p_c_cd VARCHAR2)
return t_test_object pipeline
IS
BEGIN
FOR J IN)
Select distinct test_object)
next_appearance_dt,--862,
'YOUTH '.
) AS test_object
Jen.next_appearance base
WHERE 1 = 1
AND (base.next_appearance_dt = p_dt)
AND (base.circuit_point_cd = p_c_cd)
- and cse.information_id = 322
-ORDER 15 - alias_name
)loop
PIPE ROW (J.test_object);
END loop;
END;/
Run function
SELECT * FROM TABLE (F_REPORT (TO_DATE('25-sep-2015','dd-mon-yyyy'),'1 '))
Error
ORA-22950: cannot ORDER objects without map or ORDER method
ORA-06512: at "F_REPORT", line 5
22950 00000 - "cannot ORDER objects without map or ORDER method.
* Cause: an object type must have a defined for map or ORDER method
all comparisons other than equality and inequality comparisons.
* Action: Define a map or ORDER method for the object type
I know the reason of this error and the reason is that I use the clause separate in my pipeline service, but do not know how to get rid of this error...
Confuse you the type of table with the object type. He forge
Select test_object (next_appearance_dt) test_object
Not:
Select t_test_object (next_appearance_dt) test_object
Then:
SQL > CREATE OR REPLACE
FUNCTION f_report (DATE p_dt 2,
3 P_C_CD VARCHAR2
4 )
5 t_test_object of RETURN
6 IN PIPELINE
7 EAST
BEGIN 8
9 FOR (IN) v_rec
10 WITH () DID
11. SELECT TO_DATE('01-jan-2015','dd-mon-yyyy') NEXT_APPEARANCE_DT
the double 12
13 )
14 select test_object (next_appearance_dt) test_object
15 from t
16 ) LOOP
PIPE 17 ROW (v_rec.test_object);
18 END OF LOOP;
END 19;
20.The function is created.
SY.
-
How to save data in the text file of Spartan 3
Hi all
I would like to kindly save the data table text file or a spreadsheet on vi using fpga spartan 3e as an fpga target. Once I added all the functions related to the operation of file, it gave an error that these functions are not supported by the target device.
could you please help me with this
Thank you
Rania
Hi David,
Thank you for posting. You use LabVIEW? If so, what version of LabVIEW FPGA do you use? You use a host VI, or any deployment of code at your target to run? The file IO VI probably won't compile to target because they are not intended to be used on your host computer. Resources and the paths of files do not exist on the target FPGA, but rather on the side of the host. I have included a link below that describes how to transfer data between the FPGA and host. I hope this helps!
http://zone.NI.com/reference/en-XX/help/371599F-01/lvfpgaconcepts/pfi_data_transfer/
-
How to acquire data from the memory of the meter
I am a beginner of Labview. I don't know how to acquire data from the memory of the meter.
I read a few examples of data acquisition, but apparently not similar to my case. I can't use DAQ in my computer, because I don't have DAQ card.
Could someone give me some pointers? Similar examples would be great.
-
How do I stop using the product key in my PC, so I can use it in my laptop?
A long time ago I had installed Windows Vista (original) on my PC at home. But now I m leaving in another city and I m just using my laptop. I received a message through the Windows Activation (¨The product key you typed is already use¨) and two options: buy a new online or type a different product key. I Don t want to buy anything and I Don t have a different product key. So, how can I stop using the product key in my PC (which i Don t use it!), so I can type in my laptop? Maybe uninstall Windows in my PC could solve the problem, but I Don t want to travel back home 7 hours for this! What can I do now?
PS. : Sorry about my English, I m still learning!
A long time ago I had installed Windows Vista (original) on my PC at home. But now I m leaving in another city and I m just using my laptop. I received a message through the Windows Activation (¨The product key you typed is already use¨) and two options: buy a new online or type a different product key. I Don t want to buy anything and I Don t have a different product key. So, how can I stop using the product key in my PC (which i Don t use it!), so I can type in my laptop? Maybe uninstall Windows in my PC could solve the problem, but I Don t want to travel back home 7 hours for this! What can I do now?
PS. : Sorry about my English, I m still learning!
Your English is very good.
You simply need to activate Windows in the laptop by phone call at a command prompt, type slui 4.
You * must * also to remove Windows from your desktop computer, but if it is to wait a few moments, it shouldn't be a problem.
-
Issue while loading data using the file Rules Essbase
Hi all
I am facing problem while loading data using the Rules file. In the rules file, I rejected several members in two areas (two dimensions). Now if I load the data using the rules file I'm getting errors for all members in the dataload.err file. If I reject mutiple members of a single field, the data load without settling errors in the dataload.err file.
I want to know how rmany members of several fields of ejection for loading data using the file Rules Essbase? Is it possible?
Okay, okay... I think that you must assign Global Select / reject Boolean in the parameters of loading data as 'Or':
-
Unloading of data using the ORACLE_LOADER
CREATE TABLE S_ORG_BU_trg
EXTERNAL ORGANIZATION
(TYPE ORACLE_LOADER
Tempdir default DIRECTORY
ACCESS SETTINGS
(records delimited BY newline
fields
terminated BY ', '.
' optionally enclosed BY ' "'
lrtrim
missing field VALUES are NULL
)
LOCATION ("S_ORG_BU_trg0.dmp"))
AS SELECT * FROM S_ORG_BU;
SQL error: ORA-30657: operation not supported on external organized table
30657.0000 - "operation not supported on external-organized table".
* Cause: User attempted on the operation on an external table which is
not supported.
* Action: Don't do that!
Does type Oracle_Loader does not read the table and load the CSV
My requirement is to read the data and create a flat file. I want to use the portal if possible
Of http://docs.oracle.com/cd/E11882_01/server.112/e22490/et_concepts.htm#SUTIL1357
- The
ORACLE_LOADER
access driver is the default value. It loads data from external to internal tables tables. The data must come from text data files. (TheORACLE_LOADER
access driver cannot perform the unloading; in other words, he can't move data from an internal table to an external table.) - The
ORACLE_DATAPUMP
access driver can perform loading and unloading. The data must come from binary dump files. Loads of internal tables of external tables are made by extraction from files of binary dump. Unloading of internal tables to external tables are make by filling binary dump of the external table files. TheORACLE_DATAPUMP
access driver can write files to dump only as part of creating an external table with the SQLCREATE TABLE AS SELECT
statement. Once the dump file is created, it can be read many times, but it cannot be changed (i.e., no DML operation can be performed).
You will be able to unload and create an external table (using the ORACLE_DATAPUMP type), but the file will not be csv or readable in the same direction.
- The
Maybe you are looking for
-
Can't get Mickey/Minnie talking time - Watch BONES 3
I have recently updated my watch to 3 OS and can not get Mickey/Minnie at about the time when hit. I already have so that 'Press to talk Time' has been selected on (watch and phone). Watch is not in silent Mode and the volume is up. I restarted the w
-
HP 15-g073nr Notebook PC: 3.4 GB of Ram instead of 4 GB of Ram
I check the Task Manager and it displays 3.4 GB of ram as maximum instead of 4 GB use. How can I use the size of ram? My Bios is up to date and I have not seen anywhere to remap the RAM. I have 64-bit as well. Here is a screenshot.
-
connection with the printer problem
Since the evolution of the router, I can not connect with my Epson printer
-
Dv7t Quad Edition 00 6B: I can replace my keyboard with back Ligh keyboard?
I tried to remove the keyboard! but I did not know how to replace the keyboard of my laptop What can I repalce with a backlight keyboard for my laptop? Please help me
-
I can't open microsoft office outlook. It says cannot open the outlook window. I tried to run "outlook.exe/resetnavpane, but it shows and error msg 'make sure you typed the name correctly and then try again.