Exu00E9cute an SQL Query statement.
Hi,
Can someone tel me if exist a transaction code who can help me to execute an SQL query (far than my report), either UPDATE or SELECT statement ?
Thanks in advance.
Mustapha
Hi Shiva,
I want to execute a SQL query like : Select vbeln from vbpa where vbeln = '00000545645'. and show to me a list (the result) in the same page.
P.S : I want to test a join query without going through the debugging.
thank you.
Best regards
Mustapha
Similar Messages
-
How to insert a sql query statement in the table
I have a stored procedure which has different insert,update statements on different tables. I am writing a trigger on these tables such that when the record is updated or inserted in these tables a trigger should fire and should write the old value,new value and the query (insert or update) that caused the trigger to fire in the seperate table. Is there any way to find out the exact query statement that fired the trigger?
Rather than inventing your own demi-donkeyed solution I recommend you consider using Oracle's Fine-Grained Auditing which does precisely this.
Cheers, APC -
How to get the SQL Query statement of a Search Form ?
Hi all,
We have a requirement to send the query result of an ADF Search Form into report application (Crystal rpt).
Crystal can accept data source as query statement. SO I think of getting the exact query statement "generated" by the ADF Search form and send it to crystal.
Is this possible ?
Thank you very much,
xtantoTry the various get methods of the viewObject such as getQuery:
http://www.oracle.com/webapps/online-help/jdeveloper/10.1.2/state/content/navId.4/navSetId._/vtAnchor.getQuery%28%29/vtTopicFile.bc4jjavadoc%7Crt%7Coracle%7Cjbo%7CViewObject%7Ehtml/ -
SQL query statement for stored procedure / function listing ...
Hi everyone,
Is there a SQL query to list all the stored procedures and functions of an user in an Oracle 8 database?
I have this idea:
select * from USER_SOURCE where TYPE = 'PROCEDURE' or TYPE = 'FUNCTION'
but I am not too sure whether this is correct.
Thanks in advance,
EricYeah
I agree with you Garcia , my above posting was a correction to the query mentioned in the question only.
you are correct
If you only want the name of the object,
SELECT Object_Name from User_Objects where object_type in ( 'PROCEDURE' ,'FUNCTION');
is much faster than Selecting (distinct) from User_Source. -
Simple SQL query statement is needed
I need a simple SQL query to fetch records which is existed in all the departments.
for example: i want to list the employees which are existed in each and every department.. not sure how should i get those.. will anyone help me please.. thanks in advanceI think it would be wise to go to the following training:
Oracle Database <version> : Introduction to SQL
You will get the information you are looking for in five days. You can go find a tutorial on ANSI SQL, as advised by this board for free, to fix your immediate problem with a simple query. But, I personally recommend a more formal class specific to Oracle, as you will also get information about PL/SQL, and you get the benefit with working with other DBA/programmers when you are learning. This will solve your immediate issue, and any future issues with the language.
You can find it in the Education section of the Oracle website. -
Help! with sql:query statement
Using JSTL, I am trying to select two tables from two different database. The tables do not contain the same information but just happen to have the same name "desc" . I have something like this.
<sql:query var="result">
Select trim(DATA.desc), trim(TEXT.desc) from DATA, TEXT
</sql:query>
<c:forEach items="${result.rows}" var="row1">
<c:out value="${row1}"/>
</c:forEach>It displays the second table which is TEXT.desc and ignores the other DATA.desc.
How do I display them both?Is there a way to query it and output the result in an array?Sure - you can use the call to rowsByIndex which returns a 2d array:
I think the following should work
<sql:query var="result">
Select trim(DATA.desc) as dataDesc, trim(TEXT.desc) as textDesc from DATA, TEXT
</sql:query>
<c:forEach items="${result.rowsByIndex}" var="row1">
<c:out value="${row1[0]}"/>. <c:out value="${row1[1]}"/>
</c:forEach>However the previous code should have worked. I would double check your data and query that it is returning the data you think it is.
Cheers,
evnafets -
Passing a string into an SQL query IN statement
Hello,
I need to connect to a database to pull some data to dynamically create a form based on the data I pull back. My SQL query works fine when I manually run it through a SQL client tool, but when I try to pass it through my workflow I'm having trouble with passing my string into the IN part of the statement. So if for example my SQL query is:
SELECT Field1, Field2, Field3 FROM Table1 WHERE Field4 IN (?)
I have a process variable that has the string I'm trying to pass into the ?, but I don't seem to be able to get the query to run. I have tried setting up my query to run as a Parameterized Query (passing my string process variable into the ?), and by setting the query up through xPath (where I am calling my process variable with an xPath declaration), but am not having any luck.
The process variable I am trying to pass is formatted such that I'm passing 'Value1','Value2','Value3' but I can reformat this string if need be. Even with using test data I can't get the query to return anything. For test data I have tried: 'Value1','Value2','Value3' ; Value1','Value2','Value3 ; Value1,Value2,Value3 but the query never returns any data. I can't seem to see how to format the string to pass into the query. The Query will work with a single Value in the test data, but as soon as I try to pass multiple values within the string it fails. Any suggestions?The problem looks to be a limit on what I can pass into the SQL query component. My string is coming from data returned from another database. I take the xml output from that database call, pass it through a set variable component to remove my xml tags from the string, and then format the string in a script component (I have to do it this way because of the way the data coming out of my first database call). I've put in loggers, and can see that the string I'm passing into my query that is giving me problems, is formatted the same way as if I were to use the concat function Scott listed above. It looks like there is a limitation on what can be passed in my variable. I have tried creating my entire SQL query statement in a set variable component, and then just calling the process variable that holds that statement, but there is a character limit of 128 character for what can be passed in a variable through xpath in the SQL query component.
The next thing I tried was changing my SQL where clause. Instead of passing my variable directly into the IN statement I set up a PATINDEX('%:'+countyname+ ':%', ?) > 0 call to check for the values in my database call. As you can see I took out the "," that I was passing as part of my string, thinking that the SQL component was getting confused by them, and placed ":" characters around my values being passed in my string variable. No matter what I try to do though I'm not able to get the query to run. The component looks like it is taking my string, and is seeing the whole thing as a string instead of passing it as individual values within a string.
I think I'm getting close, but I keep getting a Content not allowed in prolog exception in the server logs. -
How-To populate SELECT LIST default value from SQL Query
OK, I've done my homework, and did not find my answer in the Forum, so here it is.
I have a Page that displays fields from a SQL Query. The Page also has below that radiogroups, checkboxes, and Select Lists to allow the user to change values in the fields that are displayed at the top of the Region. I am able to pre-populate the radiogroups and checkboxes by performing a SELECT in the 'Source value or expression' of the Source area of the Page Item.
However, I am unable to do the same for the Select List fields. Their default value ends up being the first value in the LOV ('-- None --' for NULL values). Source Used: Only when current value in session state is null. Source Type: SQL Query. Also, when I first go into the Page when running it, and check the Session State values, they are all null, so I don't understand why the field is not populated by the SQL Query statement as the radiogroups and checkboxes are.
Any suggestions??? I've tried all sorts of combinations.Thank you for the suggestion.
I had considered that, but cannot do so, because we are using Oracle Application Express more for development than for data containment.
We have all our data in an Oracle 10.g DB which is separate from the OAEX server, and the OAEX app will reference that data via VIEWs and DB LINKs. We are doing so primarily as an added data security layer, where the data is housed separate from the app, in case the Web site is ever compromised. The data that can be viewed is restricted to a subset of the actual data that is available.
Since the data is on a separate server, (I assume) we will not be able to set the source type to Database column, because (I asume) that is dependent upon the data being housed by the OAEX server.
That still leaves me with having to populate the field with a SELECT statement from the Oracle DB. This unfortuneately is almost a show-stopper for me because of down-stream processing data requirements. Have not been able to come up with contingencies yet. -
Hi friends,
Can u plz tell me when exactly we can use "Query SQL Stmt" and "Update SQL Stmt"?If you have a scenario that uses the JDBC adapter to connect to the "sending" system and pull data out of it, you will use these options.
You formulate a SQL statement that queries the database and gets certain information, the JDBC adapter then uses that information to populate the message type that you built in the integration repository.
You then create an update statement with SQL to tell the database what to do after it has grabbed the data it needs and populated the message type for mapping.
Say for example you wanted to get all the data from the usr01 table in your SAP database (bad example, but bare with me) you could do something like this:
<b>SQL QUERY STATEMENT:</b> SELECT * FROM USR01
And then following that you wanted to change the MANDT table (once again, don't actually run this command)
<b>UPDATE SQL STATEMENT:</b> UPDATE USR01 SET MANDT='100' WHERE MANDT='100'
Message was edited by:
Ethan West -
BUG IN JDEVELOPER !!! SQL QUERY
Hi JDev Forumers ;o)
I was wondering how I could accomplish to set my attribute labels and display the customized ones in a JSP page.
I would like to display employee numer instead of empno, how did you do this?
When i try to set the databse columns on entity level he's building the query wrongly in the view object it's a BIG BUG in JDeveloper!
He's building the SQL Query statement wrong:
This is my query statement of the employee view after i've set the database columns:
SELECT Emp.Employee Number AS EMPNO,
Emp.Employee Name AS ENAME,
Emp.JOB,
Emp.Manager AS MGR,
Emp.HIREDATE,
Emp.Salary AS SAL,
Emp.Commission AS COMM,
Emp.Department Number AS DEPTNO
FROM EMP Emp
it has to be the other way around!!
Nathalie RomanNathalie:
I didn't realize JDeveloper was a 'he'! I was able to change the attribute name from empno to Employee_Name in the attribute settings for the app module. I then built a BC4J application and when I run the JSP, the column is showing as 'Employee_Name'. Additionally, I was able to create a data tag in a JSP that refers to the attribute as such:
<jbo:ShowValue datasource="dsemp" dataitem="Employee_Number" ></jbo:ShowValue>
In both cases, the query is built correctly. Is this what you were trying to do? If so, please reply with your steps and I'll see if I can help further.
Thanks,
Lynn
null -
Sql query not executed using recordset
Hi All,
I am trying to first format and then execute SQL query statement using recordset object with DI API. the issue is with vb.net's string formatting. I want to use 'USE [DB_Name]' statement in SQL and then 'Alter Procedure ..' statement. as this has to be the first statement in sql , I am using 'GO' in between and seperating each sentence with following syntax.
Dim AltProc as string
AltProc = " USE [DB_name]" & Environment.NewLine
AltProc = AltProc & " GO " & Environment.NewLine
AltProc = AltProc & " ALTER proc [proc_name] " & Environment.NewLine
'---------------------and so on
Orec.DoQuery(AltProc)
this formatting does not recognize new line and gives 'incorrect syntax near 'Go'' error. strange thing is, if I take this query in SQL, it runs perfectly and I can see it getting formatted with each new line created. I tried even VbcrLf but it didnt work.
any one has any idea?
thanks in advance,
BinitaHI Binita
The reason:
GO is the "command" delimiter of MS Query Editor.
It is not working with RecordSet Object.
In MS SQL 2008 version you can define the schema before the procedure name but in SQL server 2000/2005 it is not possible.
IN SQL 2008 use the Fully Qualified name instead of GO:
Dim AltProc as string
AltProc = " ALTER proc [DB_name].[dbo].[proc_name] " + vbcrlf
'---------------------and so on
Orec.DoQuery(AltProc)
it is not working on MS SQL 2008 i have tried.
'CREATE/ALTER PROCEDURE' does not allow specifying the database name as a prefix to the object name.'
Regards,
J.
Edited by: Janos Nagy on Jun 22, 2009 2:55 PM -
SQL query question for SQL Swing Applet
Hi
I am building a little SQL Swing applet.
I was wondering if there is a SQL query statement to
find:
* The names of all the tables in the Database loaded.
* The number of tables in a database loaded.
Thank you very much in advance, A.Not positive, but check out Connection.getMetaData(). It returns a DatabaseMetaData instance that has a number of get... methods that may provide the info you need.
-
Sql query slow due to case statement on Joins
Hi
The sql query runs very slow for 30 min when the below case statement is added on the joins. Could you please let me know how to tune it. if the case statement is not there then it runs only for 1 min.
*( CASE*
WHEN PO_DIST_GL_CODE_COMB.SEGMENT2 <> '1000'
THEN PO_DIST_GL_CODE_COMB.SEGMENT1 || PO_DIST_GL_CODE_COMB.SEGMENT2 || '_' || NVL(PO_DIST_GL_CODE_COMB.SEGMENT6,'000')
WHEN DT_REQ_ALL.EMPMGMTCD IS NOT NULL AND
PO_DIST_GL_CODE_COMB.SEGMENT2 = '1000'
THEN DT_REQ_ALL.EMPMGMTCD
END =DB2.DB2_FDW_MGMT_V.MH_CHILD )
SELECT DISTINCT
D.DB2_FDW_MGMT_V.RC_PARENT,
DT_REQ_ALL.FULL_NAME,
DT_REQ_ALL.EMP_COMPANY_CODE,
DT_REQ_ALL.EMP_COST_CENTER,
PO.PO_VENDORS.VENDOR_NAME,
PO_PO_HEADERS_ALL2.SEGMENT1,
PO_PO_HEADERS_ALL2.CREATION_DATE,
PO_DIST_GL_CODE_COMB.SEGMENT1,
PO_DIST_GL_CODE_COMB.SEGMENT2,
PO_PO_HEADERS_ALL2.CURRENCY_CODE,
PO_INV_DIST_ALL.INVOICE_NUM,
PO_INV_DIST_ALL.INVOICE_DATE,
(PO_INV_DIST_ALL.INVOICE_AMOUNT* PO_Rates_GL_DR.CONVERSION_RATE),
(NVL(to_number(PO_DIST_ALL.AMOUNT_BILLED),0) * PO_Rates_GL_DR.CONVERSION_RATE),
PO_LINES_LOC.LINE_NUM,
GL.GL_SETS_OF_BOOKS.NAME,
CASE
WHEN TRUNC(PO_PO_HEADERS_ALL2.CREATION_DATE) > PO_INV_DIST_ALL.INVOICE_DATE
THEN 1
ELSE 0
END ,
PO.PO_REQUISITION_LINES_ALL.LINE_LOCATION_ID,
TRUNC(PO_PO_HEADERS_ALL2.CREATION_DATE,'WW') + 8 WEEK_Ending
FROM
DB2.DB2_FDW_MGMT_V,
PO.PO_VENDORS,
PO.PO_HEADERS_ALL PO_PO_HEADERS_ALL2,
GL.GL_CODE_COMBINATIONS PO_DIST_GL_CODE_COMB,
AP.AP_INVOICES_ALL PO_INV_DIST_ALL,
PO.PO_DISTRIBUTIONS_ALL PO_DIST_ALL,
PO.PO_LINES_ALL PO_LINES_LOC,
GL.GL_SETS_OF_BOOKS,
PO.PO_REQUISITION_LINES_ALL,
PO.PO_LINE_LOCATIONS_ALL,
AP.AP_INVOICE_DISTRIBUTIONS_ALL PO_DIST_INV_DIST_ALL,
APPS.HR_OPERATING_UNITS,
PO.PO_REQ_DISTRIBUTIONS_ALL,
SELECT DISTINCT
PO_RDA.DISTRIBUTION_ID,
PO_RLA.requisition_line_id,
PO_RHA.DESCRIPTION PO_Descr,
PO_RHA.NOTE_TO_AUTHORIZER PO_Justification,
Req_Emp.FULL_NAME,
GL_CC.SEGMENT1 Req_Company_Code,
GL_CC.SEGMENT2 Req_Cost_Center,
Req_Emp_CC.SEGMENT1 Emp_Company_Code,
Req_Emp_CC.SEGMENT2 Emp_Cost_Center,
(Case
When GL_CC.SEGMENT2 <> 8000
Then TRUNC(GL_CC.SEGMENT1) || TRUNC(GL_CC.SEGMENT2) || '_' || NVL(GL_CC.SEGMENT6,'000')
Else TRUNC(Req_Emp_CC.SEGMENT1) || TRUNC(Req_Emp_CC.SEGMENT2) || '_' || NVL(Req_Emp_CC.SEGMENT6,'000')
End) EmpMgmtCD
FROM
PO.po_requisition_lines_all PO_rla,
PO.po_requisition_headers_all PO_rha,
PO.PO_REQ_DISTRIBUTIONS_ALL po_RDA,
GL.GL_CODE_COMBINATIONS gl_cc,
HR.PER_ALL_PEOPLE_F Req_Emp,
HR.PER_ALL_ASSIGNMENTS_F Req_Emp_Assign,
HR.hr_all_organization_units Req_Emp_Org,
HR.pay_cost_allocation_keyflex Req_Emp_CC
WHERE
PO_RDA.CODE_COMBINATION_ID = GL_CC.CODE_COMBINATION_ID and
PO_RLA.REQUISITION_LINE_ID = PO_RDA.REQUISITION_LINE_ID AND
PO_RLA.to_person_id = Req_Emp.PERSON_ID AND
PO_RLA.REQUISITION_HEADER_ID = PO_RHA.REQUISITION_HEADER_ID AND
(trunc(PO_rla.CREATION_DATE) between Req_Emp.effective_start_date and Req_Emp.effective_end_date OR
Req_Emp.effective_start_date IS NULL) AND
Req_Emp.PERSON_ID = Req_Emp_Assign.PERSON_ID AND
Req_Emp_Assign.organization_id = Req_Emp_Org.organization_id AND
(trunc(PO_rla.CREATION_DATE) between Req_Emp_Assign.effective_start_date and Req_Emp_Assign.effective_end_date OR
Req_Emp_Assign.effective_start_date IS NULL) AND
Req_Emp_Assign.primary_flag = 'Y' AND
Req_Emp_Assign.assignment_type = 'E' AND
Req_Emp_Org.cost_allocation_keyflex_id = Req_Emp_CC.cost_allocation_keyflex_id
) DT_REQ_ALL,
SELECT
FROM_CURRENCY,
TO_CURRENCY,
CONVERSION_DATE,
CONVERSION_RATE
FROM GL.GL_DAILY_RATES
UNION
SELECT Distinct
'USD',
'USD',
CONVERSION_DATE,
1
FROM GL.GL_DAILY_RATES
) PO_Rates_GL_DR
WHERE
( PO_DIST_GL_CODE_COMB.CODE_COMBINATION_ID=PO_DIST_ALL.CODE_COMBINATION_ID )
AND ( PO_DIST_ALL.LINE_LOCATION_ID=PO.PO_LINE_LOCATIONS_ALL.LINE_LOCATION_ID )
AND ( PO_PO_HEADERS_ALL2.VENDOR_ID=PO.PO_VENDORS.VENDOR_ID )
AND ( PO_PO_HEADERS_ALL2.ORG_ID=APPS.HR_OPERATING_UNITS.ORGANIZATION_ID )
AND ( GL.GL_SETS_OF_BOOKS.SET_OF_BOOKS_ID=APPS.HR_OPERATING_UNITS.SET_OF_BOOKS_ID )
AND ( PO_PO_HEADERS_ALL2.CURRENCY_CODE=PO_Rates_GL_DR.FROM_CURRENCY )
AND ( trunc(PO_PO_HEADERS_ALL2.CREATION_DATE)=PO_Rates_GL_DR.CONVERSION_DATE )
AND ( PO_DIST_ALL.REQ_DISTRIBUTION_ID=PO.PO_REQ_DISTRIBUTIONS_ALL.DISTRIBUTION_ID(+) )
AND ( PO.PO_REQ_DISTRIBUTIONS_ALL.REQUISITION_LINE_ID=PO.PO_REQUISITION_LINES_ALL.REQUISITION_LINE_ID(+) )
AND ( PO_LINES_LOC.PO_HEADER_ID=PO_PO_HEADERS_ALL2.PO_HEADER_ID )
AND ( PO.PO_LINE_LOCATIONS_ALL.PO_LINE_ID=PO_LINES_LOC.PO_LINE_ID )
AND ( PO_DIST_ALL.REQ_DISTRIBUTION_ID=DT_REQ_ALL.DISTRIBUTION_ID(+) )
AND ( PO_DIST_ALL.PO_DISTRIBUTION_ID=PO_DIST_INV_DIST_ALL.PO_DISTRIBUTION_ID(+) )
AND ( PO_INV_DIST_ALL.INVOICE_ID(+)=PO_DIST_INV_DIST_ALL.INVOICE_ID )
AND ( PO_INV_DIST_ALL.SOURCE(+) <> 'XML GATEWAY' )
AND
( NVL(PO_PO_HEADERS_ALL2.CANCEL_FLAG,'N') <> 'Y' )
AND
( NVL(PO_PO_HEADERS_ALL2.CLOSED_CODE, 'OPEN') <> 'FINALLY CLOSED' )
AND
( NVL(PO_PO_HEADERS_ALL2.AUTHORIZATION_STATUS,'IN PROCESS') <> 'REJECTED' )
AND
( TRUNC(PO_PO_HEADERS_ALL2.CREATION_DATE) BETWEEN TO_DATE('01-jan-2011') AND TO_DATE('04-jan-2011') )
AND
PO_Rates_GL_DR.TO_CURRENCY = 'USD'
AND
DB2.DB2_FDW_MGMT_V.RC_PARENT In ( 'Unavailable','Corp','Commercial' )
AND
( CASE
WHEN PO_DIST_GL_CODE_COMB.SEGMENT2 <> '1000'
THEN PO_DIST_GL_CODE_COMB.SEGMENT1 || PO_DIST_GL_CODE_COMB.SEGMENT2 || '_' || NVL(PO_DIST_GL_CODE_COMB.SEGMENT6,'000')
WHEN DT_REQ_ALL.EMPMGMTCD IS NOT NULL AND
PO_DIST_GL_CODE_COMB.SEGMENT2 = '1000'
THEN DT_REQ_ALL.EMPMGMTCD
END =DB2.DB2_FDW_MGMT_V.MH_CHILD )Explain plan. sorry can't get the explain plan from sql. this is from toad.
Plan
SELECT STATEMENT ALL_ROWSCost: 53,932 Bytes: 2,607 Cardinality: 1
79 HASH UNIQUE Cost: 53,932 Bytes: 2,607 Cardinality: 1
78 NESTED LOOPS OUTER Cost: 53,931 Bytes: 2,607 Cardinality: 1
75 NESTED LOOPS OUTER Cost: 53,928 Bytes: 2,560 Cardinality: 1
72 NESTED LOOPS Cost: 53,902 Bytes: 2,552 Cardinality: 1
69 NESTED LOOPS OUTER Cost: 53,900 Bytes: 2,533 Cardinality: 1
66 NESTED LOOPS OUTER Cost: 53,898 Bytes: 2,521 Cardinality: 1
63 HASH JOIN OUTER Cost: 53,896 Bytes: 2,509 Cardinality: 1
40 TABLE ACCESS BY INDEX ROWID TABLE PO.PO_DISTRIBUTIONS_ALL Cost: 3 Bytes: 26 Cardinality: 1
39 NESTED LOOPS Cost: 17,076 Bytes: 2,400 Cardinality: 1
37 NESTED LOOPS Cost: 17,073 Bytes: 2,374 Cardinality: 1
34 NESTED LOOPS Cost: 17,070 Bytes: 2,362 Cardinality: 1
31 NESTED LOOPS Cost: 17,066 Bytes: 2,347 Cardinality: 1
29 NESTED LOOPS Cost: 17,066 Bytes: 2,339 Cardinality: 1
26 NESTED LOOPS Cost: 17,065 Bytes: 2,312 Cardinality: 1
23 NESTED LOOPS Cost: 17,064 Bytes: 2,287 Cardinality: 1
20 NESTED LOOPS Cost: 17,062 Bytes: 2,261 Cardinality: 1
17 NESTED LOOPS Cost: 17,056 Bytes: 6,678 Cardinality: 3
15 HASH JOIN Cost: 17,056 Bytes: 6,663 Cardinality: 3
13 MERGE JOIN CARTESIAN Cost: 135 Bytes: 30,352 Cardinality: 14
5 VIEW VIEW DB2.DB2_FDW_MGMT_V Cost: 4 Bytes: 2,128 Cardinality: 1
4 SORT UNIQUE Cost: 4 Cardinality: 1
3 UNION-ALL
1 REMOTE REMOTE SERIAL_FROM_REMOTE PRDFDW.WORLD
2 FAST DUAL Cost: 3 Cardinality: 1
12 BUFFER SORT Cost: 135 Bytes: 560 Cardinality: 14
11 VIEW DB2. Cost: 131 Bytes: 560 Cardinality: 14
10 SORT UNIQUE Cost: 131 Bytes: 310 Cardinality: 14
9 UNION-ALL
7 TABLE ACCESS BY INDEX ROWID TABLE GL.GL_DAILY_RATES Cost: 65 Bytes: 270 Cardinality: 9
6 INDEX SKIP SCAN INDEX (UNIQUE) GL.GL_DAILY_RATES_U1 Cost: 64 Cardinality: 1
8 INDEX SKIP SCAN INDEX (UNIQUE) GL.GL_DAILY_RATES_U1 Cost: 64 Bytes: 4,368 Cardinality: 546
14 TABLE ACCESS FULL TABLE PO.PO_HEADERS_ALL Cost: 16,920 Bytes: 32,754 Cardinality: 618
16 INDEX UNIQUE SCAN INDEX (UNIQUE) HR.HR_ORGANIZATION_UNITS_PK Cost: 0 Bytes: 5 Cardinality: 1
19 TABLE ACCESS BY INDEX ROWID TABLE HR.HR_ORGANIZATION_INFORMATION Cost: 2 Bytes: 35 Cardinality: 1
18 INDEX RANGE SCAN INDEX HR.HR_ORGANIZATION_INFORMATIO_FK2 Cost: 1 Cardinality: 2
22 TABLE ACCESS BY INDEX ROWID TABLE HR.HR_ORGANIZATION_INFORMATION Cost: 2 Bytes: 26 Cardinality: 1
21 INDEX RANGE SCAN INDEX HR.HR_ORGANIZATION_INFORMATIO_FK2 Cost: 1 Cardinality: 1
25 TABLE ACCESS BY INDEX ROWID TABLE GL.GL_SETS_OF_BOOKS Cost: 1 Bytes: 25 Cardinality: 1
24 INDEX UNIQUE SCAN INDEX (UNIQUE) GL.GL_SETS_OF_BOOKS_U2 Cost: 0 Cardinality: 1
28 TABLE ACCESS BY INDEX ROWID TABLE PO.PO_VENDORS Cost: 1 Bytes: 27 Cardinality: 1
27 INDEX UNIQUE SCAN INDEX (UNIQUE) PO.PO_VENDORS_U1 Cost: 0 Cardinality: 1
30 INDEX UNIQUE SCAN INDEX (UNIQUE) HR.HR_ALL_ORGANIZATION_UNTS_TL_PK Cost: 0 Bytes: 8 Cardinality: 1
33 TABLE ACCESS BY INDEX ROWID TABLE PO.PO_LINES_ALL Cost: 4 Bytes: 60 Cardinality: 4
32 INDEX RANGE SCAN INDEX (UNIQUE) PO.PO_LINES_U2 Cost: 2 Cardinality: 4
36 TABLE ACCESS BY INDEX ROWID TABLE PO.PO_LINE_LOCATIONS_ALL Cost: 3 Bytes: 12 Cardinality: 1
35 INDEX RANGE SCAN INDEX PO.PO_LINE_LOCATIONS_N1 Cost: 2 Cardinality: 1
38 INDEX RANGE SCAN INDEX PO.PO_DISTRIBUTIONS_N1 Cost: 2 Cardinality: 1
62 VIEW DB2. Cost: 36,819 Bytes: 1,090 Cardinality: 10
61 HASH UNIQUE Cost: 36,819 Bytes: 2,580 Cardinality: 10
60 NESTED LOOPS Cost: 36,818 Bytes: 2,580 Cardinality: 10
57 NESTED LOOPS Cost: 36,798 Bytes: 2,390 Cardinality: 10
54 NESTED LOOPS Cost: 36,768 Bytes: 2,220 Cardinality: 10
51 NESTED LOOPS Cost: 36,758 Bytes: 1,510 Cardinality: 10
48 NESTED LOOPS Cost: 36,747 Bytes: 1,050 Cardinality: 10
45 HASH JOIN Cost: 36,737 Bytes: 960 Cardinality: 10
43 HASH JOIN Cost: 34,602 Bytes: 230,340 Cardinality: 3,490
41 TABLE ACCESS FULL TABLE HR.PER_ALL_PEOPLE_F Cost: 1,284 Bytes: 1,848,420 Cardinality: 44,010
42 TABLE ACCESS FULL TABLE PO.PO_REQUISITION_LINES_ALL Cost: 31,802 Bytes: 18,340,080 Cardinality: 764,170
44 TABLE ACCESS FULL TABLE HR.PER_ALL_ASSIGNMENTS_F Cost: 2,134 Bytes: 822,540 Cardinality: 27,418
47 TABLE ACCESS BY INDEX ROWID TABLE HR.HR_ALL_ORGANIZATION_UNITS Cost: 1 Bytes: 9 Cardinality: 1
46 INDEX UNIQUE SCAN INDEX (UNIQUE) HR.HR_ORGANIZATION_UNITS_PK Cost: 0 Cardinality: 1
50 TABLE ACCESS BY INDEX ROWID TABLE HR.PAY_COST_ALLOCATION_KEYFLEX Cost: 1 Bytes: 46 Cardinality: 1
49 INDEX UNIQUE SCAN INDEX (UNIQUE) HR.PAY_COST_ALLOCATION_KEYFLE_PK Cost: 0 Cardinality: 1
53 TABLE ACCESS BY INDEX ROWID TABLE PO.PO_REQUISITION_HEADERS_ALL Cost: 1 Bytes: 71 Cardinality: 1
52 INDEX UNIQUE SCAN INDEX (UNIQUE) PO.PO_REQUISITION_HEADERS_U1 Cost: 0 Cardinality: 1
56 TABLE ACCESS BY INDEX ROWID TABLE PO.PO_REQ_DISTRIBUTIONS_ALL Cost: 3 Bytes: 17 Cardinality: 1
55 INDEX RANGE SCAN INDEX PO.PO_REQ_DISTRIBUTIONS_N1 Cost: 2 Cardinality: 1
59 TABLE ACCESS BY INDEX ROWID TABLE GL.GL_CODE_COMBINATIONS Cost: 2 Bytes: 19 Cardinality: 1
58 INDEX UNIQUE SCAN INDEX (UNIQUE) GL.GL_CODE_COMBINATIONS_U1 Cost: 1 Cardinality: 1
65 TABLE ACCESS BY INDEX ROWID TABLE PO.PO_REQ_DISTRIBUTIONS_ALL Cost: 2 Bytes: 12 Cardinality: 1
64 INDEX UNIQUE SCAN INDEX (UNIQUE) PO.PO_REQ_DISTRIBUTIONS_U1 Cost: 1 Cardinality: 1
68 TABLE ACCESS BY INDEX ROWID TABLE PO.PO_REQUISITION_LINES_ALL Cost: 2 Bytes: 12 Cardinality: 1
67 INDEX UNIQUE SCAN INDEX (UNIQUE) PO.PO_REQUISITION_LINES_U1 Cost: 1 Cardinality: 1
71 TABLE ACCESS BY INDEX ROWID TABLE GL.GL_CODE_COMBINATIONS Cost: 2 Bytes: 19 Cardinality: 1
70 INDEX UNIQUE SCAN INDEX (UNIQUE) GL.GL_CODE_COMBINATIONS_U1 Cost: 1 Cardinality: 1
74 TABLE ACCESS BY INDEX ROWID TABLE AP.AP_INVOICE_DISTRIBUTIONS_ALL Cost: 26 Bytes: 16 Cardinality: 2
73 INDEX RANGE SCAN INDEX AP.AP_INVOICE_DISTRIBUTIONS_N7 Cost: 2 Cardinality: 37
77 TABLE ACCESS BY INDEX ROWID TABLE AP.AP_INVOICES_ALL Cost: 3 Bytes: 47 Cardinality: 1
76 INDEX RANGE SCAN INDEX (UNIQUE) AP.AP_INVOICES_U1 Cost: 2 Cardinality: 1 ThanksForming a new table "new_table" with 3 tables which particiapate in CASE statement logic.
with DT_REQ_ALL as
SELECT DISTINCT
PO_RDA.DISTRIBUTION_ID,
PO_RLA.requisition_line_id,
PO_RHA.DESCRIPTION PO_Descr,
PO_RHA.NOTE_TO_AUTHORIZER PO_Justification,
Req_Emp.FULL_NAME,
GL_CC.SEGMENT1 Req_Company_Code,
GL_CC.SEGMENT2 Req_Cost_Center,
Req_Emp_CC.SEGMENT1 Emp_Company_Code,
Req_Emp_CC.SEGMENT2 Emp_Cost_Center,
(Case
When GL_CC.SEGMENT2 8000
Then TRUNC(GL_CC.SEGMENT1) || TRUNC(GL_CC.SEGMENT2) || '_' || NVL(GL_CC.SEGMENT6,'000')
Else TRUNC(Req_Emp_CC.SEGMENT1) || TRUNC(Req_Emp_CC.SEGMENT2) || '_' || NVL(Req_Emp_CC.SEGMENT6,'000')
End) EmpMgmtCD
FROM
PO.po_requisition_lines_all PO_rla,
PO.po_requisition_headers_all PO_rha,
PO.PO_REQ_DISTRIBUTIONS_ALL po_RDA,
GL.GL_CODE_COMBINATIONS gl_cc,
HR.PER_ALL_PEOPLE_F Req_Emp,
HR.PER_ALL_ASSIGNMENTS_F Req_Emp_Assign,
HR.hr_all_organization_units Req_Emp_Org,
HR.pay_cost_allocation_keyflex Req_Emp_CC
WHERE
PO_RDA.CODE_COMBINATION_ID = GL_CC.CODE_COMBINATION_ID and
PO_RLA.REQUISITION_LINE_ID = PO_RDA.REQUISITION_LINE_ID AND
PO_RLA.to_person_id = Req_Emp.PERSON_ID AND
PO_RLA.REQUISITION_HEADER_ID = PO_RHA.REQUISITION_HEADER_ID AND
(trunc(PO_rla.CREATION_DATE) between Req_Emp.effective_start_date and Req_Emp.effective_end_date OR
Req_Emp.effective_start_date IS NULL) AND
Req_Emp.PERSON_ID = Req_Emp_Assign.PERSON_ID AND
Req_Emp_Assign.organization_id = Req_Emp_Org.organization_id AND
(trunc(PO_rla.CREATION_DATE) between Req_Emp_Assign.effective_start_date and Req_Emp_Assign.effective_end_date OR
Req_Emp_Assign.effective_start_date IS NULL) AND
Req_Emp_Assign.primary_flag = 'Y' AND
Req_Emp_Assign.assignment_type = 'E' AND
Req_Emp_Org.cost_allocation_keyflex_id = Req_Emp_CC.cost_allocation_keyflex_id
SELECT DISTINCT
D.DB2_FDW_MGMT_V.RC_PARENT,
DT_REQ_ALL.FULL_NAME,
DT_REQ_ALL.EMP_COMPANY_CODE,
DT_REQ_ALL.EMP_COST_CENTER,
PO.PO_VENDORS.VENDOR_NAME,
PO_PO_HEADERS_ALL2.SEGMENT1,
PO_PO_HEADERS_ALL2.CREATION_DATE,
PO_DIST_GL_CODE_COMB.SEGMENT1,
PO_DIST_GL_CODE_COMB.SEGMENT2,
PO_PO_HEADERS_ALL2.CURRENCY_CODE,
PO_INV_DIST_ALL.INVOICE_NUM,
PO_INV_DIST_ALL.INVOICE_DATE,
(PO_INV_DIST_ALL.INVOICE_AMOUNT* PO_Rates_GL_DR.CONVERSION_RATE),
(NVL(to_number(PO_DIST_ALL.AMOUNT_BILLED),0) * PO_Rates_GL_DR.CONVERSION_RATE),
PO_LINES_LOC.LINE_NUM,
GL.GL_SETS_OF_BOOKS.NAME,
CASE
WHEN TRUNC(PO_PO_HEADERS_ALL2.CREATION_DATE) > PO_INV_DIST_ALL.INVOICE_DATE
THEN 1
ELSE 0
END ,
PO.PO_REQUISITION_LINES_ALL.LINE_LOCATION_ID,
TRUNC(PO_PO_HEADERS_ALL2.CREATION_DATE,'WW') + 8 WEEK_Ending
FROM
( SELECT * FROM
DB2.DB2_FDW_MGMT_V,
GL.GL_CODE_COMBINATIONS PO_DIST_GL_CODE_COMB,
DT_REQ_ALL
WHERE
DB2.DB2_FDW_MGMT_V.RC_PARENT In ( 'Unavailable','Corp','Commercial' )
AND
CASE
WHEN PO_DIST_GL_CODE_COMB.SEGMENT2 <> '1000'
THEN PO_DIST_GL_CODE_COMB.SEGMENT1 || PO_DIST_GL_CODE_COMB.SEGMENT2 || '_' || NVL(PO_DIST_GL_CODE_COMB.SEGMENT6,'000')
WHEN DT_REQ_ALL.EMPMGMTCD IS NOT NULL AND
PO_DIST_GL_CODE_COMB.SEGMENT2 = '1000'
THEN DT_REQ_ALL.EMPMGMTCD
END =DB2.DB2_FDW_MGMT_V.MH_CHILD
) new_table,
PO.PO_VENDORS,
PO.PO_HEADERS_ALL PO_PO_HEADERS_ALL2,
AP.AP_INVOICES_ALL PO_INV_DIST_ALL,
PO.PO_DISTRIBUTIONS_ALL PO_DIST_ALL,
PO.PO_LINES_ALL PO_LINES_LOC,
GL.GL_SETS_OF_BOOKS,
PO.PO_REQUISITION_LINES_ALL,
PO.PO_LINE_LOCATIONS_ALL,
AP.AP_INVOICE_DISTRIBUTIONS_ALL PO_DIST_INV_DIST_ALL,
APPS.HR_OPERATING_UNITS,
PO.PO_REQ_DISTRIBUTIONS_ALL,
SELECT
FROM_CURRENCY,
TO_CURRENCY,
CONVERSION_DATE,
CONVERSION_RATE
FROM GL.GL_DAILY_RATES
UNION
SELECT Distinct
'USD',
'USD',
CONVERSION_DATE,
1
FROM GL.GL_DAILY_RATES
) PO_Rates_GL_DR
WHERE
( PO_DIST_GL_CODE_COMB.CODE_COMBINATION_ID=PO_DIST_ALL.CODE_COMBINATION_ID )
AND ( PO_DIST_ALL.LINE_LOCATION_ID=PO.PO_LINE_LOCATIONS_ALL.LINE_LOCATION_ID )
AND ( PO_PO_HEADERS_ALL2.VENDOR_ID=PO.PO_VENDORS.VENDOR_ID )
AND ( PO_PO_HEADERS_ALL2.ORG_ID=APPS.HR_OPERATING_UNITS.ORGANIZATION_ID )
AND ( GL.GL_SETS_OF_BOOKS.SET_OF_BOOKS_ID=APPS.HR_OPERATING_UNITS.SET_OF_BOOKS_ID )
AND ( PO_PO_HEADERS_ALL2.CURRENCY_CODE=PO_Rates_GL_DR.FROM_CURRENCY )
AND ( trunc(PO_PO_HEADERS_ALL2.CREATION_DATE)=PO_Rates_GL_DR.CONVERSION_DATE )
AND ( PO_DIST_ALL.REQ_DISTRIBUTION_ID=PO.PO_REQ_DISTRIBUTIONS_ALL.DISTRIBUTION_ID(+) )
AND ( PO.PO_REQ_DISTRIBUTIONS_ALL.REQUISITION_LINE_ID=PO.PO_REQUISITION_LINES_ALL.REQUISITION_LINE_ID(+) )
AND ( PO_LINES_LOC.PO_HEADER_ID=PO_PO_HEADERS_ALL2.PO_HEADER_ID )
AND ( PO.PO_LINE_LOCATIONS_ALL.PO_LINE_ID=PO_LINES_LOC.PO_LINE_ID )
AND ( PO_DIST_ALL.REQ_DISTRIBUTION_ID=DT_REQ_ALL.DISTRIBUTION_ID(+) )
AND ( PO_DIST_ALL.PO_DISTRIBUTION_ID=PO_DIST_INV_DIST_ALL.PO_DISTRIBUTION_ID(+) )
AND ( PO_INV_DIST_ALL.INVOICE_ID(+)=PO_DIST_INV_DIST_ALL.INVOICE_ID )
AND ( PO_INV_DIST_ALL.SOURCE(+) 'XML GATEWAY' )
AND
( NVL(PO_PO_HEADERS_ALL2.CANCEL_FLAG,'N') 'Y' )
AND
( NVL(PO_PO_HEADERS_ALL2.CLOSED_CODE, 'OPEN') 'FINALLY CLOSED' )
AND
( NVL(PO_PO_HEADERS_ALL2.AUTHORIZATION_STATUS,'IN PROCESS') 'REJECTED' )
AND
( TRUNC(PO_PO_HEADERS_ALL2.CREATION_DATE) BETWEEN TO_DATE('01-jan-2011') AND TO_DATE('04-jan-2011') )
AND
PO_Rates_GL_DR.TO_CURRENCY = 'USD'
-
Complex query using 'sql like' statement.
Given the following basic class structure.
public class Project {
private String name;
private Architecture architecture;
private Resources resources;
public Architecture getArchitecture();
public void setArchitecture(Architecture architecture);
public Resources getResources();
public void setResources();
public String getName();
public void setName(String name);
public Architecture {
private String name;
public String getName();
public void setName(String name);
public Resources {
private String name;
public String getName();
public void setName(String name);
we want to be able to do a query like:
find all Projects where (Project.name.indexOf("a") > 0) &&
(Project.architecture.name.indexof("b") > 0)
In essence a "like" comparison across String properties of the JDO objects.
Is it supported in KODO?? Anyone tried it out? Also, is it possible to
generate SQL type query in KODO?
rgds
NKNote that this relies on a current bug in Kodo -- we should escape out the
'%' character, but we don't.
Some day, we'll fix that bug. But, before then, we will introduce a proper,
supported mechanism for finding records that have a string field that
contains some substring.
-Patrick
On 5/30/02 6:12 PM, "Andrew" <[email protected]> wrote:
Hi,
I wanted to perform a LIKE statement to get records where the partial string
existed in a field -> eg. select a where a.field LIKE "SPRING" - 2 records,
SpringSteen & MindSprings
I did it like this:
setFieldName("Spring");
String sFilter = "field.startsWith(%\" + getFieldName() + \"%)"; -
Extent anExtent = pm.getExtent(this.getClass(), true);
Query aQuery = pm.newQuery(this.getClass(), anExtent, sFilter);
return (Collection) aQuery.execute();
Hope it helps. oh, don't know about the generating sql query.
Nitin Kanani wrote:
Given the following basic class structure.
public class Project {
private String name;
private Architecture architecture;
private Resources resources;
public Architecture getArchitecture();
public void setArchitecture(Architecture architecture);
public Resources getResources();
public void setResources();
public String getName();
public void setName(String name);
public Architecture {
private String name;
public String getName();
public void setName(String name);
public Resources {
private String name;
public String getName();
public void setName(String name);
we want to be able to do a query like:
find all Projects where (Project.name.indexOf("a") > 0) &&
(Project.architecture.name.indexof("b") > 0)
In essence a "like" comparison across String properties of the JDO
objects.
Is it supported in KODO?? Anyone tried it out? Also, is it possible to
generate SQL type query in KODO?
rgds
NK
Patrick Linskey [email protected]
SolarMetric Inc. http://www.solarmetric.com -
SEQUENCE Select within an SQL Query with an ORDER BY statement
Does anyone know why you cannot use an ORDER BY statement within an SQL query when also selecting from a SEQUENCE? My query was selecting production data as a result of a filtered search. I want to take the results of the filtered search and create a transaction. I have a sequence for generating transaction numbers where I select NEXTVAL. Since I could possibly obtain multiple, yet distinct, rows based upon my search criteria, I wanted to use an ORDER BY statement to simplify and order the resulting row(s).
I was able to get the SQL select with SEQUENCE.NEXTVAL to work without the ORDER BY, so I know that my SQL is correct. Thanks in-advance.Okay,
I understand. You want the sequence assigned first and the you want to ORDER BY. You
can do this using pipelined functions. See here:
CREATE OR REPLACE TYPE emp_rec_seq AS OBJECT (
seq NUMBER,
ename VARCHAR2 (20),
job VARCHAR2 (20),
sal NUMBER
CREATE OR REPLACE TYPE emp_tab_seq AS TABLE OF emp_rec_seq;
CREATE OR REPLACE FUNCTION get_emp_with_sequence
RETURN emp_tab_seq PIPELINED
IS
my_record emp_rec_seq := emp_rec_seq (NULL, NULL, NULL, NULL);
BEGIN
FOR c IN (SELECT dummy.NEXTVAL seq, ename, job, sal
FROM emp)
LOOP
my_record.seq := c.seq;
my_record.ename := c.ename;
my_record.job := c.job;
my_record.sal := c.sal;
PIPE ROW (my_record);
END LOOP;
RETURN;
END get_emp_with_sequence;after that, you can do a select like this:
SELECT seq, ename, job, sal
FROM TABLE (get_emp_with_sequence)
order by enamewhich will get you this:
SEQ ENAME JOB SAL
1053 BLAKE MANAGER 2850
1054 CLARK MANAGER 2450
1057 FORD ANALYST 3000
1062 JAMES CLERK 950
1055 JONES MANAGER 2975
1052 KING MANAGER 20000
1060 MARTIN SALESMAN 1250
1063 MILLER CLERK 1300
1064 DKUBICEK MANAGER 12000
1056 SCOTT ANALYST 3000
1058 SMITH CLERK 800
1061 TURNER SALESMAN 1500
1059 WARD SALESMAN 1250Denes Kubicek
http://deneskubicek.blogspot.com/
http://htmldb.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------
Maybe you are looking for
-
Stock Status on a particular date in past.
Hi MM Gurus, I am looking for a transaction code that should give me a report when i enter a plant and /or storage location along with the date from and date to. This report should have all the material that are there in that plant and /or storage lo
-
How to send e-mail when a trigger condition is verified?
Hi, I want to implement a trigger to send an e-mail when the condition of the tigger is verified. Thanks in advance. Paulo.
-
Cannot find UML diagrams in the "New" dialog
I must be missing something simple but I can't for the life of me figure out how to create a UML diagram in JDev 11g. I had previously had the beta version with which I had no problems. But since I installed the release version, there is no "Diagram"
-
PO output Condition record changes
Hello Gurus, Is there any way to view the changes made to the condition records used for PO output types. Best regards, MK
-
Atheros WiFi drivers Windows 8.1 (64bit)
I am using a MSI FM2-A75IA-E53 mainboard. Worked fine with Windows 8. After the update to Windows 8.1 My Atheros 9271 WiFi does not work. Is there an update for the drivers? When i check the driver version it seems that Windows uses the XP driver ver