Getting data into another collection from UNION of 2 collections
Hi,
I have a requirement like this.
cursor c1 is
select a,b,c,d from abc
UNION
select e,f,g,h from def;
I am replacing cursor with collection variables.
Created collection variables for both the select statements as
select a,b,c,d BULK COLLECT INTO coll_abc from abc;
select e,f,g,h BULK COLLECT INTO coll_def from def;
Now, I want to get the UNION of both these collections into another collection variable.
Can I write
select * BULK COLLECT INTO coll_abc_def from coll_abc,coll_def;Thanks
Rajiv
Hi,
I ran into some problem here.
TYPE main_coll is RECORD (
dte_ent_woc date,
sched_beg_dte_woc date,
inst_dte_woc date,
sub_acct_no_woc number,
wo_stat_woc varchar2(5),
wo_key_woc number);
TYPE main_coll_typ IS TABLE OF main_coll;
main_collection_union main_coll_typ;
-- Declaration Ends
BEGIN
err_loc := 10;
file_name := '14932_welcome_call_' ||
TO_CHAR(TRUNC(SYSDATE), 'YYYYMMDD') ||
'.txt';
file_handle := UTL_FILE.fopen('/apps/custsrv/custsrv/data/output',
file_name,
'W');
UTL_FILE.put_line(file_handle,
'"DV DATE"~"SCHEDULE DATE"~"INSTALL DATE"~"ACCOUNT
#"~"ADDRESS1"~"ADDRESS2"~"CITY"~"STATE"~"ZIP"~"ACTIVATION DATE"~"CURRENT BALANCE"~"DV STATUS"~"ACCOUNT
STATUS"~"RESTART DATE"~"IS DV LAST?"');
err_loc := 20;
SELECT dte_ent_woc,
sched_beg_dte_woc,
inst_dte_woc,
sub_acct_no_woc,
wo_stat_woc,
wo_key_woc
BULK COLLECT INTO main_collection_union
FROM ((SELECT dte_ent_woc,
sched_beg_dte_woc,inst_dte_woc,
sub_acct_no_woc,
wo_stat_woc,
wo_key_woc
FROM woc_base_comp
WHERE
wo_typ_woc = 'DV'
AND MOD(INSTR(wo_rsn_woc, 'BF'), 2) != 0)
UNION
SELECT /* index(a DTE_ENT_WOO_I) */
dte_ent_woo,
sched_beg_dte_woo,inst_dte_woo,
sub_acct_no_woo,
wo_stat_woo,
wo_key_woo
FROM woo_base_open a
WHERE
wo_typ_woo = 'DV'
AND MOD(INSTR(wo_rsn_woo, 'BF'), 2) != 0
AND wo_stat_woo in ('X','O')
);When I compiled, I got these errors...
Error(146,10): PL/SQL: Statement ignored
Error(146,51): PLS-00302: component 'SUB_ACCT_NO_WOC' must be declared
Error(155,10): PL/SQL: SQL Statement ignored
Error(159,35): PL/SQL: ORA-00904: "MAIN_COLLECTION_UNION"."DTE_ENT_WOC": invalid identifier
.I understand that the declared collection is not being recognized.
But, I am not getting where to declare and where to define the collection.
Any help regarding this would be appreciated.
Thanks
Rajiv
Similar Messages
-
Function module to get data into internal table from Excel file sheets
Hi,
I have to upload customers from excel file.
we are donloading customer data excel file sheets.
Customer data in 1 sheet, tax data the other sheet of same excel file, Customer master-Credit data in other sheet of same excel file.
so i have 3-4 sheet in one excel file.
now my requirement is to get the data from excel file into internal table.
is there any function module.
Thanks & RegardsI am sending you the idea with an example how you can upload data from an EXCEL file into an internal table. I am not sure if you can take data from different sheet in the same EXCEL file. I think that this is not possible (try it )
Upload the data into an internal table, like the way that I am describing in the above:
DATA: L_MAX_COL_NB TYPE I.
DATA: l_file_name LIKE RLGRAP-FILENAME.
Just to be sure that is the correct type for the FM.
l_file_name = P_FILE_NAME.
L_MAX_COL_NB = 58. "Maximum nb of colums that the FM can read.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = l_file_name
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = L_MAX_COL_NB
I_END_ROW = 9999
TABLES
INTERN = PT_EXCEL
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF.
Now you should upload the data into your own itab. The Function Module will return to you all the an itab
from all fields and columns. Define the structure of the uploading file into SE11 - Data Dictionary. Then read the fieldcatalog of this structure. In the code that I am sending to you, I am insearting an empty line into the internal table and then I am assigning this line into a corresponding field-symbol. Then I am able to change the working area - so and the line of the itab. Propably you could you the statement APPEND INITIAL LINE TO (your_table_name) ASSIGNING <your_field_symbol>, but the example was written in an old SAP version.
FIELD-SYMBOLS:
<F_REC> LIKE WA_UPLOAD_FILE, "working are of the uploading file
<F_FIELD> TYPE ANY.
DATA: COLUMN_INT TYPE I,
C_FIELDNAME(30) TYPE C.
PERFORM GET_FIELDCATOLG TABLES FIELDCAT
USING 'ZECO_CHARALAMBOUS_FILE'.
LOOP AT PT_EXCEL.
AT NEW ROW.
ASSIGN WA_UPLOAD_FILE TO <F_REC>.
ENDAT.
COLUMN_INT = PT_EXCEL-COL.
READ TABLE FIELDCAT INTO WA_FIELDCAT INDEX COLUMN_INT.
CONCATENATE '<F_REC>-' WA_FIELDCAT-FIELDNAME INTO C_FIELDNAME.
ASSIGN (C_FIELDNAME) TO <F_FIELD>.
<F_FIELD> = PT_EXCEL-VALUE.
AT END OF ROW.
APPEND WA_UPLOAD_FILE TO GT_UPLOAD_FILE.
CLEAR WA_UPLOAD_FILE.
ENDAT.
ENDLOOP.
With Regards
George
Edited by: giorgos michaelaris on Mar 4, 2010 3:44 PM -
How can I get data in flat file from Pool table and cluster table ?
Hi,
I am working in one Achiving project. My requirement is to get data into flat file from Cluster table and pool table.
Is there any tool avilable to download data into flat file from pool table and cluster table ?
if table name given in the selection screen then data will be downloaded into flat file.
waiting for quick response.
Best Regards,
BansidharData cannot be retrived directly form the cluster table
as the Cluster results are stored in Cluster Key say for example PCLkey
and form that Key we need to fetch the data
these clustes are not the part of PNP or PNPCE tables
for ur info kindly check -
I have a process that creates a collection with data from multiple tables. The query returns multiple rows in 'Sql commands' tab. The same query is used to create the collection in 'Before Header' and when i create a region with Region source as
Select * From apex_collections Where collection_name = 'load_dashboard';
At the time of rendering the page shows me 'no data found'.
what could be the problem? Are there any prerequisites before creating the collection?
Thanks in Advance,
SriramHi Denes,
Below is my code for creating and saving data into the collection.
if apex_collection.collection_exists(p_collection_name =>'load_dashboard') then
apex_collection.delete_collection(
p_collection_name =>'load_dashboard');
end if;
apex_collection.create_collection_from_query(
p_collection_name => 'load_dashboard',
p_query => 'select a.rowid
,b.first_name
,b.last_name
,c.job_title
,d.parent
,d.child_level_1
,d.child_level_2
,a.resource_allocation
,a.person_id
,a.month_id
,a.oracom_project_id ,wwv_flow_item.md5(a.rowid,b.first_name,b.last_name,c.job_title,d.parent,d.child_level_1,d.child_level_2,a.resource_allocation,a.person_id,a.month_id,a.oracom_project_id)
from oracom_resource_management a, oracom_people b,oracom_job c ,oracom_project d where a.supervisor_id=886302415 and a.month_id=201312 and a.oracom_job_id=c.job_id and a.person_id=b.person_id and a.oracom_project_id=d.oracom_project_id',
p_generate_md5 => 'YES'
Sriram. -
How to get data to internal table from function module tr_inspect_objects
How to get data from funtion module to an internal table .
function module name is tr_inspect_objects(code inspectore se10)
how top collect all task request data into one internal table using this fm or we have to create another fm .
If you have already made FM please give us the code .Hi,
You can use tables E070 or E071 to get data into your internal tables instead of a function module.
Hope this helps.
BR
Dep -
Inserting Data into a Collection
Hi
Can anybody suggest how to Insert data into a Collection from another Collection Using Bulk Binds in PLSQL?
My scenario :-
CREATE OR REPLACE PACKAGE te_ar IS
TYPE srm_rec IS RECORD (col1 <table>.<col1>%TYPE, col2 <table>.<col2>%TYPE);
TYPE srm_rec_list IS TABLE OF srm_rec INDEX BY BINARY_INTEGER;
FUNCTION z_srm_rec RETURN srm_rec_list PIPELINED;
END te_ar;
CREATE OR REPLACE PACKAGE BODY te_ar IS
FUNCTION z_srm_rec RETURN srm_rec_list PIPELINED IS
v_srm_rec srm_rec;
TYPE col1_t IS TABLE OF <table>.<col1>%TYPE INDEX BY BINARY_INTEGER;
TYPE col2_t IS TABLE OF <table>.<col2>%TYPE INDEX BY BINARY_INTEGER;
col1_tt col1_t;
col2_tt col2_t;
CURSOR c1
IS
SELECT col1, col2 FROM table;
BEGIN
OPEN c1;
FETCH c1 BULK COLLECT INTO col1_tt,col2_tt;
FORALL i IN 1 .. c1%ROWCOUNT
v_srm_rec.col1(i) := col1_tt(i);
v_srm_rec.col2(i) := col2_tt(i);
PIPE_ROW(v_srm_rec);
CLOSE c1;
RETURN;
END;
END te_ar;
I have created a Record Type in which I am trying to insert rows using bulk bind and return it using a pipelined function.
This approach is throwing me errors in which I am unable to use both Pipelining and Bulk Binds together so that I can make the Performance of the entire bit better.
Please suggest the way forward.
Any other relevant info I am ready to supply.
Thanks
ArnabFORALL is used for bulk DML statements and will not work for your collections. http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/forall_statement.htm#LNPLS01321. I think you may want to use a regular FOR loop.
-
Hi All,
i am concerned with entering data into a collection (NameValuePair) of two elements using as assign activity. the data is string information and below is part of the xsd:-
<element name="Data" maxOccurs="1" minOccurs="0">
<complexType>
<sequence>
<element name="NameValuePair" maxOccurs="unbounded"
minOccurs="0">
<complexType>
<sequence minOccurs="1">
<element name="name" type="string"/>
<element name="value" type="string"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
my assign activities look like:-
<from>'Parent Concurrent Req ID'</from>
<to>$Invoke_InputVariable.payload/ns20:Data/ns20:NameValuePair[1]/ns20:name</to>
</copy>
<copy>
<from>$Receive_ConcReqID_InputVariable.Response/ns10:ConcRequestID</from>
<to>$Invoke_InputVariable.payload/ns20:Data/ns20:NameValuePair[1]/ns20:value</to>
</copy>
<copy>
<from>'Errored Child Req ID'</from>
(line 626) <to>$Invoke_InputVariable.payload/ns20:Data/ns20:NameValuePair[2]/ns20:name</to>
</copy>
<copy>
<from>$Invoke_ConcRequestsQuery_DB_QueryChildJob_DetailsSelect_OutputVariable.FndConcurrentRequestsCollection/ns9:FndConcurrentRequests[$ForEachCounter]/ns9:requestId</from>
<to>$Invoke_InputVariable.payload/ns20:Data/ns20:NameValuePair[2]/ns20:value</to>
but however i am getting an error at runtime that 'Exception is thrown because the to-spec at line 626 is evaluated to be empty'
Could someone suggest how i should get this done.. if there is a more correct approach, pls suggest.
regards
RakeshHi Rakesh,
If you edit your assign and right click on the expression bellow you should see "ignoringMissingFromData" and "insertMissingToData" options... I believe the latter will solve your problem...
Cheers,
Vlad -
I am creating an applet to draw graphs.
I have only made standalone applets before.
My data will come from a database.
The user will have the data selected for them, when they select the applet page, the data to be drawn will already have been selected.
i.e. I only need to give data across in the initialisation stage of the applet.
What is the standard way to get data into an applet?
By a giving a file path, by direct contact with the DB, with direct contact with another servlet or by giving the data in the HTML page the Applet is contained in.
(The data will come from the same server as the applet)
Maybe somone can point me to a tutorial on this?I am currently developing some graph applets, too. At first I implemented direct database access via JDBC, but found out, that this ain't suitable, because you can get in serious trouble with customers who don't want to open database tcp ports in their internal firewall system which - from a security point of view - is a good decision.
So I gathered information about other methods to get data across the network. RMI needs own ports just like JDBC. Direct access to port 80 would be a good, so one could use Java's network capabilities. But this needs lots of coding on both ends (server and client-applet) and so takes time and is error prone.
Using SOAP leads to fat applets and so I gave XML-RPC a try. In my case I have an XML-RPC server written in PHP (using the PEAR module see: http://pear.php.net ) and in my applet I use the XML-RPC library from the Apache Group (see: http://ws.apache.org/xmlrpc/ ). This works just fine!
Pros:
- small library code in applet (less than 200 KB)
- only needs one network port. standard is 80 (http) which is almost everywhere available
- applet code is independent from server code and architecture, as almost every language has some XML-RPC module (other than RMI being a Java-only solution)
- free of charge & open source
- reliable
Cons:
- based on XML it can slow down things a bit when lots of data has to be sent over a slow network link - but that's more of a general problem in network application development
- other than SOAP/RMI you can not transmit/access whole objects but only data of primitive types (int, boolean, string, ..), so you have to wrap and unwrap your data
By now I am very pleased with the decision I made earlier this year. :) -
How to insert data into a table from an xml document
using the XmlSql Utility, how do I insert data into a table from an xml document, using the sqlplus prompt.
if i use the xmlgen.insertXML(....)
requires a CLOB file, which i dont have, only the xml doc.
Cant i insert directly from the doc to the table?
the xmlgen examples I have seen first convert a table to a CLOB xmlString and then insert it into another table.
Isnt there any other way?Your question is little perplexing.
If you're using XML SQL Utility from
the commandline, just use putXML.
java OracleXML putXML
null -
HOW TO INSERT DATA INTO SQL SERVER FROM MS ACCESS TABLE??
NEED TO INSERT DATA INTO SQL SERVER FROM MS ACCESS TABLE.
this is another method
http://www.mssqltips.com/sqlservertip/2484/import-data-from-microsoft-access-to-sql-server/
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Insert data into fact table from source database tables
here i try to insert data into fact table from source database tables here is the query
ALTER procedure [dbo].[facttable]
as
insert into [pp dw].dbo.Dimfact(Prod_ID,Production_ID,Material_ID,Equip_ID,WC_ID,Recipe_ID,Quantity,costprice)
select Products.[Product ID],[Production ID],Materials.[Material ID],[Equipment ID],[Work Centre ID],[Recipy ID],Quantity,[cost price]
from
[PRODUCTION PLANNING 2].dbo.[Products],
[PRODUCTION PLANNING 2].dbo.[Production Detail],
[PRODUCTION PLANNING 2].dbo.[Material category],
[PRODUCTION PLANNING 2].dbo.[Materials],
[PRODUCTION PLANNING 2].dbo.[Equipment],
[PRODUCTION PLANNING 2].dbo.[Working Centre] ,
[PRODUCTION PLANNING 2].dbo.[Recipies]
where
Products.[Product ID] in (13, 14, 15, 16, 17) and
[Production Detail].[Production ID] in (1, 2, 3) and
[Materials].[Material ID] in (1, 2, 3, 4, 5) and
[Equipment].[Equipment ID] in (1, 2, 3, 4) and
[Working Centre].[Work Centre ID] in (1, 2, 3) and
[Recipies].[Recipy ID] in (1, 2, 3) and
[Material category].[Category ID] in (8, 9, 10, 11, 12, 13)
and when i execute query it shows me error
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Dimfact_Dimproduct". The conflict occurred in database "pp dw", table "dbo.Dimproduct", column 'Prod_ID'.
ERD IS
HOW TO SOLVE THIS PROBLEM?I cant see any join conditions in your query posted. Whats the purpose of the query above. It will just bring you a cartesian product (cross join) of tables involved subjected to filters. Are you sure this is the correct query?
The error you're getting may be because you've not yet populated DimProduct or may be because of logic you used in popultaing DimProduct causing it to miss some records which is what query is referring to in above case.
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
How can i retrieved data into the infocube from archived files
hi,
i have archived cube data and i have to load data into the cube from archived files.
so now i want to find archived files and how to load data into the cube.
thanksHi.....
Reloading archived data should be an exception rather than the general case, since data should be
archived only if it is not needed in the database anymore. When the archived data target is serving also as a
datamart to populate other data targets, Its recommend that you load the data to a copy of the original
(archived) data target, and combine the two resulting data targets with a MultiProvider.
In order to reload the data to a data target, you have to use the export DataSource of the archived data
target. Therefore, you create an update rule based on the respective InfoSource (technical name 8<data
target name>). You then trigger the upload either by using Update ODS data in data target or by
replicating the DataSources of the MYSELF source system and subsequently scheduling an InfoPackage
for the respective InfoSource
If you want to read the data for reporting or
control purposes, you have to write a report, which reads data from the archive files sequentially.
Alternatively, you can also use the Archiving Information System (AS). This tool enables you to define an
InfoStructure, and create reports based on these InfoStructures. The InfoStructures define an index for
the archive file data. At the moment, the archiving process in the BW system does not fill the
InfoStructures during the archiving session automatically. This has to be performed manually when
needed.
Another way of displaying data from the archive file is by using the Extractor checker (TCODE RSA3).
Enter the name of the export DataSource of the respective data target (name of the data target preceded
by 8), and choose the archive files that are to be read. The extractor checker reads the selected archive
files sequentially. Selection conditions can be entered for filtering but have to be entered in in internal
format
It will remain same in the change log table.
Check this link :
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b32837f2-0c01-0010-68a3-c45f8443f01d
Hope this helps you...........
Regards,
Debjani............ -
Not getting data into 3rd int table
Hi all,
here i ve data in 2 internal tables. this data i want store into 3rd internal table, here am adding with inner join but am not getting data into 3rd one.
plz check my logic.
REPORT ZEXCHANGE_RETES .
TABLES : tcurr, " Exchange Rates
/msg/rabr. " Account (Posting Headers)
DATA : l_date type datum.
TYPES : begin of t_tcurr,
kurst like tcurr-kurst, " Exchange Rate type
fcurr like tcurr-fcurr, " From Currrency
gdatu like tcurr-gdatu, " Date as of which
end of t_tcurr.
TYPES : begin of t_rabr,
OW_WHGNR like /msg/rabr-OW_WHGNR,
bil_dat like /msg/rabr-bil_dat,
abrnr like /msg/rabr-abrnr,
end of t_rabr.
TYPES : begin of t_output,
kurst like tcurr-kurst,
fcurr like tcurr-fcurr,
gdatu like tcurr-gdatu,
OW_WHGNR like /msg/rabr-OW_WHGNR,
bil_dat like /msg/rabr-bil_dat,
abrnr like /msg/rabr-abrnr,
end of t_output.
DATA : it_output TYPE STANDARD TABLE OF t_output WITH HEADER LINE,
wa_output TYPE t_output.
DATA : it_rabr TYPE STANDARD TABLE OF t_rabr WITH HEADER LINE,
wa_rabr TYPE t_rabr.
DATA : it_tcurr TYPE STANDARD TABLE OF t_tcurr WITH HEADER LINE,
wa_tcurr TYPE t_tcurr.
getting data into 1st itab
SELECT kurst fcurr gdatu
from tcurr into table it_tcurr
where kurst EQ 'M'.
SORT it_tcurr by fcurr GDATU DESCENDING.
delete adjacent duplicates from it_tcurr comparing fcurr.
getting data into 2nd itab
SELECT * FROM /msg/rabr into CORRESPONDING FIELDS OF TABLE it_rabr.
SORT it_rabr BY OW_WHGNR bil_dat abrnr.
getting data into 3rd itab
SELECT t~kurst
t~fcurr
t~gdatu
r~OW_WHGNR
r~bil_dat
r~abrnr
FROM tcurr as t INNER JOIN
/msg/rabr as r on tfcurr EQ rOW_WHGNR into table it_output
WHERE rabrnr BETWEEN '00000000000000800251' AND '00000000000000800300' AND rbil_dat < wa_tcurr-gdatu.
printing output
LOOP at it_output into wa_output.
WRITE: /10 wa_output-kurst,
15 wa_output-fcurr,
25 wa_output-gdatu,
50 wa_output-OW_WHGNR,
60 wa_output-bil_dat,
80 wa_output-abrnr.
ENDLOOP.
here am not getting data into 3rd i tab.
Thanks & Regards,
sudharsan.Hi,
The select command is the most fundamental function of writing ABAP programs allowing the retrieval of data from SAP database tables.
Try filling the 3rd internal table with Loop ... Endloop.
Loop at t_tcurr.
Read table t_rabr with key field1 = t_tcurr-field1.
If sy-subrc = 0.
Move t_tcurr-field1 = itab_final-field1.
Move t_tcurr-field2 = itab_final-field2.
Move t_rabr -field3 = itab_final-field3.
Move t_rabr -field4 = itab_final-field4.
Append itab_final.
Endloop.
Hope this helps you.
Regards,
Ruthra -
How to load data into an ods from multiple info sources.
hi all...
i am given a task to load data into an ods from 3 infosources ...
can someone plz give me the flow .
thank u in advance..Hi Hara Pradhan,
You have to create 3 update rules by giving the 3 different infosources while creating each update rule. And u have to create the infopackages under each infosource. with this u can load the data to the same data target from multiple info sources.
Hope it helps!
Assign points if it helps! -
How do I get date and time component from a DATE object?
Hi All,
I need to get date and time separately from a DATE object, does
anyone know what function I should call? GetDate()? GetTime()?
I need this in a SELECT statement.
Thanks in advance and looking forward to your early reply.
Regards.
Gladywin
30/11/2001Hello,
See following SQL.
select to_char(sysdate,'dd/mm/rrrr') today_date,
to_char(sysdate,'hh24:mi') now_time
from dual
Adi
Maybe you are looking for
-
I have LR 5.3 installed under Windows 7. I download 5.6 unpadate, my sustem still says I have 5.3.
-
On Glyph palette name shows as unassigned
Hey guys, I've added some glyphs to one or our existing fonts and on the glyphs palette in InDesign CS3 that glyph's name shows as "unassigned" when I mouse over the glyph. Typically I use the Adobe glyph list (http://www.adobe.com/devnet-archive/ope
-
Business Explorer (BEX) Query open Error
Hi When opening BEX(Business Explorer) Queries from Excel , it asks for System to choose. But business doesn't want to see this option. It should go directly to open query selection for the system it has logged in. Say , it has logged in BIQ , it
-
MacBook Pro going to screensaver while in use.
I have a 15-inch, Mid 2010 MacBook Pro and recently while I am using it it goes to sleep/screensaver as if I wasn't using it at all. As soon as I move my mouse it goes back to normal, it does this once every 10 mins approx. As you can probably tell t
-
I'm confused to why my address books groups on my Mac are empty. The groups are all there but zero contacts in them. My time machine back ups show the groups and the contacts correctly but when I restore from a back up it doesn't work. The back ups i