How to retrieve data from a table that match values in a varray?
Using - Oracle 10g Release 1.2
How to do write a sql to retrieve data matching values in a varray?
I have the following:
declare
v_ct NATURAL := 0;
type t_cur is REF CURSOR;
v_cursor t_cur;
TYPE t_array IS VARRAY(100) OF NUMBER;
l_codes t_array := t_array();
begin
select count(*)
into v_ct
from table1
where ind_cd IS NULL;
IF v_ct = 0 THEN
l_codes(1) := 1;
END IF;
select count(*)
into v_ct
from table2
where cd IS NULL;
IF v_ct = 0 THEN
l_codes(2) := 2;
END IF;
OPEN v_cursor for
select * from error_table where error_cd in (SELECT * FROM TABLE(CAST(l_codes AS t_array)) );
end;
This may not answer your question, but what about a pure SQL solution?
NOTE THIS IS UNTESTED:
SELECT *
FROM ERROR_TABLE
WHERE ERROR_CD IN
SELECT 1
FROM table1
HAVING COUNT(*) > 0
UNION ALL
SELECT 2
FROM table2
HAVING COUNT(*) > 0
)HTH!
Similar Messages
-
How to Retrieve data from Variant Table
Can anyone help me by telling how to retrieve data from variant table which was created by user. I am able to see data of variant table only thru cu60 transaction but not se11. I s there any function module to do this?
Hello Mohan,
if u already have data and u want to populate it in F4 help then use below code -
u Have to make use of FM - 'F4IF_INT_TABLE_VALUE_REQUEST'
REPORT ZGILL_VALUE_REQUEST .
data: begin of lt_all occurs 0.
include structure DYNPREAD.
data end of lt_all.
data: begin of lt_selected occurs 0.
include structure DDSHRETVAL.
data: end of lt_selected.
DATA: BEGIN OF lt_code OCCURS 0,
code LIKE zgill_main-PERNR,
END OF lt_code.
data no_dyn like sy-dynnr.
Parameters : ECODE like zgill_main-PERNR.
*parameters: pernr like pa0001-pernr .
no_dyn = sy-dynnr. "give the scren no directly or sy-dynnr in case of report.
At selection-screen on value-request for ECODE.
select PERNR into table lt_code from zgill_main.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'ECODE'
dynpprog = sy-repid
dynpnr = no_dyn
dynprofield = 'ECODE'
window_title = 'Employee Details'
value_org = 'S'
DISPLAY = 'F'
TABLES
value_tab = lt_code
RETURN_TAB = lt_selected.
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
*if sy-subrc eq '0' .
write: 'success'.
*endif.
read table lt_selected index sy-tabix.
move lt_selected-fieldval to ECODE. -
How to retrieve data from catsdb table and convert into xml using BAPI
How to retrieve data from catsdb table and convert into xml using BAPI
Points will be rewarded,
Thank you,
Regards,
Jagrut BharatKumar ShuklaHi,
This is not your requirment but u can try this :
CREATE OR REPLACE DIRECTORY text_file AS 'D:\TEXT_FILE\';
GRANT READ ON DIRECTORY text_file TO fah;
GRANT WRITE ON DIRECTORY text_file TO fah;
DROP TABLE load_a;
CREATE TABLE load_a
(a1 varchar2(20),
a2 varchar2(200))
ORGANIZATION EXTERNAL
(TYPE ORACLE_LOADER
DEFAULT DIRECTORY text_file
ACCESS PARAMETERS
(FIELDS TERMINATED BY ','
LOCATION ('data.txt')
select * from load_a;
CREATE TABLE A AS select * from load_a;
SELECT * FROM A
Regards
Faheem Latif -
How to retrieve data from edcauditentity table?
Hello!
I am interested how to connect to edcauditentity table and retrieve data from this table.
I have sql query but i don't have idea how to start. For now i can connect to LiveCycle and retrieve policy name.
Thank in advance!Hello Mohan,
if u already have data and u want to populate it in F4 help then use below code -
u Have to make use of FM - 'F4IF_INT_TABLE_VALUE_REQUEST'
REPORT ZGILL_VALUE_REQUEST .
data: begin of lt_all occurs 0.
include structure DYNPREAD.
data end of lt_all.
data: begin of lt_selected occurs 0.
include structure DDSHRETVAL.
data: end of lt_selected.
DATA: BEGIN OF lt_code OCCURS 0,
code LIKE zgill_main-PERNR,
END OF lt_code.
data no_dyn like sy-dynnr.
Parameters : ECODE like zgill_main-PERNR.
*parameters: pernr like pa0001-pernr .
no_dyn = sy-dynnr. "give the scren no directly or sy-dynnr in case of report.
At selection-screen on value-request for ECODE.
select PERNR into table lt_code from zgill_main.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'ECODE'
dynpprog = sy-repid
dynpnr = no_dyn
dynprofield = 'ECODE'
window_title = 'Employee Details'
value_org = 'S'
DISPLAY = 'F'
TABLES
value_tab = lt_code
RETURN_TAB = lt_selected.
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
*if sy-subrc eq '0' .
write: 'success'.
*endif.
read table lt_selected index sy-tabix.
move lt_selected-fieldval to ECODE. -
How to retrieve data from plsql table in BI publisher Data template
Hi All,
I have created a data template for XML publisher report. In data template i m getting data from plsql table. for that i have created one package with pipelined function. I am able to run that sql from sql developer .But if i run the concurrent program then i got error like "java.sql.SQLSyntaxErrorException: ORA-00904: "XXXXX": invalid identifier".
I have used the same parameters in Data template and concurrent program....
please clarify me what needs to be done....
thanks in advance....
Regards,
DossHi Alex ,
i am using pipelined function and get the data from cursor and load it into plsql table (nested table). and i use the below in my data template to fetch the data:
<sqlStatement name="Q1">
<![CDATA[select * from table(PO_SPEND_RPT_PKG.generate_report(P_ORG_ID,P_SOB_ID,P_ORG_NAME,P_PERIOD_NAME,P_CLOSE_STATUS,P_E_PCARD_NEED,P_REPORT_TYPE))]]>
</sqlStatement>
if i run the above in sql developer i can get the result....from apps if i run i got the error "java.sql.SQLSyntaxErrorException: ORA-00904: "P_ORG_ID": invalid identifier"
Edited by: kalidoss on Sep 14, 2012 4:32 AM -
How to retrieve data from a table?
I creat a Java application that connect to a database at address 10.4.4.204 and I also creat a table in this database by SQL Navigator. This table contain colums PID, Name, history.
How can I retrieve these colums and put results to Microsoft Word. I also want these results arrange to colums in Microsoft Word too.
Then how this line become?
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@10.4.4.204:1999:db", "tung", "tung12345");
I need documents and sample code in this case ( retrive and display data from remote database host). Any one help me?This may not answer your question, but what about a pure SQL solution?
NOTE THIS IS UNTESTED:
SELECT *
FROM ERROR_TABLE
WHERE ERROR_CD IN
SELECT 1
FROM table1
HAVING COUNT(*) > 0
UNION ALL
SELECT 2
FROM table2
HAVING COUNT(*) > 0
)HTH! -
How to retrieve data from a dimension that is not directly joined to a fact
Hi,
In my case I have 2 dimensions and one fact. I need to runa report collecting data from all the three tables.
I need to do the following.
DIMA DIMB FACT1
FACT1 is joined with DIMA
DIMA is joined with DIMB
FACT1 is not Joined with DIMB.
My report should still retrieve information from DIMB by connecting FACT1 with DIMA and retrieve corresponding data from DIMB.
Please suggest how can I do this .
I am using 10.1.3 version of OBIEE
You help will be much appreciated.Hi,
I think your data model is snow-flake schema,we can get the data from snow-flake schema also.Pull the columns from both fact and DIMB into criteria.It will display the result.
mark if helpful/correct...
thanks,
prassu -
Retrieve data from cluster tables
hi
can any one explain me how to retrieve data from cluster tables
Regards
sachinyou can write a select
select * from KONV
into table it_konv
where <condition>
you cant join.. cluster tables.. -
How to retrieve data from domain(Value Range) of the table
hi
how to retrieve data from domain(Value Range) of the table
thanksHello,
You can try using the FM: DOMAIN_VALUE_GET TB_DOMAINVALUES_GET.
BR,
Suhas
Edited by: Suhas Saha on Mar 24, 2009 10:08 AM -
How to retrieve data from table(BOM_ITEM)
Hi All,
I wrote webservices using axis1.4 to get BOM information from SAP.. funtional module is CAD_DISPLAY_BOM_WITH_SUB_ITEMS
webservices works fine..I'am able to retrieve data from Export Parameter..But not able to retrieve data from table
How to retrieve data from table(BOM_ITEM)..?
Cheers, all help would be greatly appreciated
VijayHi,
1. Create Page Process.
2. Select Data Manipulation
3. In category select "Automated Row Fetch"
4. Specify process name, sequence, select "On Load - Before Header" in point.
5. Specify owner, table, primary key, and the primary key column(Item name contains primary key).
6. Create a process.
7. In each item select "Database Column" in "Source Type".
Regards,
Kartik Patel
http://patelkartik.blogspot.com/
http://apex.oracle.com/pls/apex/f?p=9904351712:1 -
How to retrieve data from excel sheet
Hi,
How to retrieve data from excel sheet into a java file.janu05 wrote:
If we append a $ in the end of the table name it is showing an error saying "invalid name,should not contain any invalid character or punctuation"Great, I'm very happy for you.
Unless that was a question. In which case you might what to tell us a little more.
Like which API you are using (assuming we are still on "reading an Excel sheet". -
Retrieve data from oracle table, table name passed in runtime into JSP
Hello All,
I am new to JSP, i have a requirement,
I need to retrieve data from oracle table, here table is passed at random. how to get the data displayed in JSP page.
can any one help me in that
thanks1) Learn SQL.
2) Learn Java.
3) Learn JDBC.
4) Learn DAO.
5) Learn HTTP.
6) Learn HTML.
7) Learn JSP/Servlet.
8) Learn JSTL.
9) Apply learned things and develop.
Whenever you stucks, please come back and post the specific coding/technical problem here. -
How to send data from internal table to the shared folder in ABAP
Hi experts,
My requirement is to transfer data from a file to shared folder. i just did reading data from a file to a internal table. Now i want to send this internal table data into a shared folder which is "
xxx\y\z....".
I do not have any idea on how to send data from internal table to the shared folder path.
can anybody please help me out how to do this?
Thanks & Regards
Sireesha.Where that folder is located, its on presentation server i.e. desktop or application server.
If its on presentation server, use FM GUI_UPLOAD.
If its on application server, then use DATASET functions. Have a look at below link.
[File Handling in ABAP|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm]
I hope it helps.
Thanks,
Vibha
Please mark all the useful answers -
How to select data from a table by passing document number from another tab
How to select data from a table by passing document number from another table.
for eg:-
I want to display name, adres, region from ADRC table
by using field delivery document number
Kind Regards,
Shanbagavalli.SHi Shanbagavalli,
There are multiple solutions to this questions a few i will try to answer and then you can take the best required for your requirements.
**Consider that you have a Internal table having document number from other table..
SELECT NAME ADRES REGION FROM ADRC
INTO IT_ADRC
FOR ALL ENTRIES IN IT_DOC
WHERE DOCUMENT_NO = IT_DOC-DOCUMENT_NO.
**Consider that you have 1 document number then
SELECT NAME ADRES REGION FROM ADRC
INTO IT_ADRC
WHERE DOCUMENT_NO = W_DOCUMENT_NO.
Hope this solves your problem.
Regards,
Kunjal -
Hi,
I am working on a report where I have to retrieve data from 3 tables(marc,mara,makt).For this I have used 3 select statements for retriving data from 3 tables.There r some fields which r not present in marc table where as present in mara and makt tables.So added thos fields in marc internal table t_marc.I have looped at marc table and used the read statement to read the data from mara table using the key field matnr from both the tables.This read statement is giving the sy-subrc value as 4.Could u pls tell me why this is happening?I am sending my code.
SELECT matnr
werks
pstat
lvorm
FROM marc
INTO TABLE t_marc
PACKAGE SIZE 500
WHERE matnr IN s_matnr
AND werks IN s_werks.
IF NOT t_marc[] IS INITIAL.
SELECT matnr
ersda
laeda
meins
FROM mara
INTO TABLE t_mara
FOR ALL ENTRIES IN t_marc
WHERE matnr = t_marc-matnr
AND ersda IN s_ersda
AND laeda IN s_laeda.
IF NOT t_mara[] IS INITIAL.
SELECT matnr
maktx
FROM makt
INTO TABLE t_makt
FOR ALL ENTRIES IN t_mara
WHERE matnr = t_mara-matnr.
LOOP AT t_marc INTO wa_marc.
READ TABLE t_mara INTO wa_mara WITH KEY matnr = t_marc-matnr.
IF sy-subrc IS INITIAL.
wa_marc-meins = wa_mara-meins.
MODIFY t_marc.
APPEND wa_marc TO t_output.
ENDIF.
READ TABLE t_makt INTO wa_makt WITH KEY matnr = t_marc-matnr.
IF sy-subrc IS INITIAL.
wa_marc-maktx = wa_makt-maktx.
MODIFY t_marc.
APPEND wa_marc TO t_output.
ENDIF.
ENDLOOP.hi hema,
Dont use three select stements for this scenario.
Just use innerjoin and join all the three tables.
Three tables should contain MATNR (material number).
By using that retrieve data from 3 tables by using a single select statement.
Eg:
SELECT DISTINCT a~matnr "MATERIAL NUMBER
a~ersda "CREATED ON
a~mtart "MATERIAL TYPE
a~meins "BASE UNIT OF MEASURE
a~bstme "ORDER UNIT
b~maktx "MATERIAL DESCRIPTION
c~bwkey "VALUATION AREA
c~lbkum "TOTAL VALUED STOCK
c~salk3 "VALUE OF TOTAL VALUED STOCK
c~stprs "STANDARD PRICE
c~peinh "PRICE UNIT
c~bklas "VALUATION CLASS
INTO TABLE it_matdetails
FROM mara AS a INNER JOIN makt AS b ON a~matnr = b~matnr
INNER JOIN mbew AS c ON a~matnr = c~matnr
INNER JOIN marc AS d ON a~matnr = d~matnr
INNER JOIN mard AS e ON a~matnr = e~matnr
WHERE b~spras = sy-langu AND a~matnr IN matnr AND d~werks IN werks AND e~lgort IN lgort.
pls reward if helpful.
Maybe you are looking for
-
Including Tagged Text in a Table of Contents
I would like to include only a few words from a given paragraph in the Table of Contents. For example in the example paragraph, I would like only the term Blather to appear in the TOC "Blather - Blah blah blah blah." Is there a way I can tag "Blather
-
SDO_UTIL.FROM_WKBGEOMETRY function
Hi there. I have been struggling to convert WKB(Blobs) to SDO_GEOMETRY. If I understand correctly there is some SDO functions that doesn't`t work in Oracle XE or should I rather say it has a differant syntax in XE than enterprise. My problem is that
-
I'm trying to create view with this command "create view MASTER.ACM AS select * from [email protected];" but I got this error "Warning: View created with compilation errors." I have no idea what I have done wrong. Could you help me to solve this prob
-
'SAP_APPL,600 has to be installed' when try to install SAP ERP EnHP3
Hi, I'm trying to install EHP3 on windows2003/oracle10.2/SAPecc6.0 by tools SPAM & SAINT. But the system send the message 'Component SAP_APPL,600 has to be installed' I want download the 2 packages: "SAP enhancement package 1 for SAP ERP 6.0" "SAP en
-
Bluetooth not working on Satellite PRO 660C
Hello, I have bought recently a laptop Satellite PRO 660C, it has embedded the Bluetooth function but I have difficulties to make it work with a GSM or an IRIS Scanner (both have the Bluetooth capability) I would like simply to transfer files from th