Simple sql statement I need help
Hello all, I need the syntax for the following sql query: "Using that a single update to write the query to update a salary of 10% for wages below 100 k and 15% for salaries above 100 k". TIAUPDATE table1 SET salary = salary BOX WHEN < 100000="" then="" salary="" *="" 1.1="" when="" salary=""> = 100000 THEN salary * 1.15 END;
Tags: Database
Similar Questions
-
Simple query sum I need help please
I need an application to do something like this:
Select customer_site_use_id
of ar_payment_schedules_all ps
where ps.status = "OP".
AND NVL (ps.receipt_confirmed_flag, 'Y') = 'Y '.
and exists (select (sum (ps1.acctd_amount_due_remaining) as amtdue)
of ar_payment_schedules_all ps1
where ps1.customer_site_use_id = ps.customer_site_use_id
and (amtdue < 0)
and ps.customer_site_use_id = 1593
I can do this too difficult. I don't know if I need it is clause and the second select statement. In it are statement, if the sum of all the acctd_amount_due_remaining in ar_payment_schedules_all for the same customer_site_use_id is less than 0, then it is in the results.Hello
user13444294 wrote:
HelloI'm just starting to post on the site. I see what you mean on the information that I need to add. I think that what you gave me but is close, the only question I have is it would start really with statement "? I have never seen it before.
Yes, the request begins with the keyword WITH. Try it.
-
query SQL max function need help
Hi all
Its simple, but I'm not able to identify the problem.
In our HRMS EBS R12, 11g database we seeded table per_all_people_f and the column employee_number (varchar2).
case 1: normal employees whose employee_number starts with the numerical value. (for example: 9213,9214,9999,10000,10001)
case 2: employee_number starts with tank like 'P' - (for example: "P-1245', ' P-1246'" ")
I am writing as a small query to get the Max (employee_number) for case 1.
Select max (employee_number) in per_all_people_f
where employee_number not like 'P-% '.
Output: 9999 (didn't come out desired)
where I employee_number 10000 and 10001.
Select * from per_all_people_f where employee_number = "10000"
Returns the values of the table...
Please let me know why (employee_number) max is coming "9999"...
Thank you and best regards,
Afzal.
then try to do this:
Select employee_number
of per_all_people_f
where employee_number not like 'P-% '.
and translate(employee_number,'x0123456789','x') is not null;
to find out what other non-digital employee_numbers you next to the P - prefix ones.
HTH
-
I have problem sql statement, can someone help me?
How are you?
SQL > select * from tst
2 order by id, vacdate;
ID VACDATE VACINTERV
---------- --------- ----------
10-15 JANUARY 13 4
10-25 JANUARY 13 6
10-27 JANUARY 13 4
20-15 JANUARY 13 4
40 1 MAY 13 3
40 13 OCTOBER 13 7
50 13 OCTOBER 13 7
50 17 OCTOBER 13 7
60 24 MAY 13 5
60 24 MAY 13 3
This table contains the id == > employee id & vacdate == > is the start date of the holiday of employees & & vacinterv = > means the time interval of the holidays for example 7 7 days from 13 October 13 until 20 October 13
the problem is there are used (IE id 10) take vacations that overlap [take 25 January 13 (range 6) until 21 January 13] but take by mistake January 27, 13 other vacation causing Holiday overlap
How to select employees who will have a vacation that overlap?
LAG analytical use:
with t as)
Select tbl.*,
case
When trolling (vacdate + vacinterv, 1, vacdate) over (partition by order of identification by vacdate) > vacdate, 1
end overlap_indicator
from tbl
)
Select distinct id
t
where overlap_indicator = 1
/
ID
----------
10
50
60SQL >
SY.
-
CALL THE PROCEDURE IN THE SQL STATEMENT
Why we cannot call a procedure inside the SQL statement?Hello
Usually when you select an item should return you data. In the case of a procedure, you cannot return any return value from the procedure directly it has to be done through some settings and to access these settings, you cannot use a simple sql statement. Where as in a function, you must return one of data that can be easily obtained accordingly.
see you soon
VT
-
Pinning on SQl statement in the library cache
Hello
Do to pin frequently used SQL statement to the shared pool...
I know that dbms_shared_pool.keep does the job for PL/SQL, but on simple SQL statements.
Experts from the clues?
Thank you
KingSee more of scripts:
-- Get address and hash_value of SQL statement select address, hash_value from v$sql where sql_text like 'your query to keep'; ------------------------------------------------------------------------------------------------ 00000000858CA2B0 2239673969 exec dbms_shared_pool.keep('00000000858CA2B0, 2239673969','C');
I think you want to pin the SQL statement that is specific to the moment analysis of long abovid.
I see no reason to pin the SQL more.Dion Cho
-
I need help in the sql statement
Hi all
im working in the hr schema
I need sql statement to answer my question
I need information to all employees
where average wage = average wage department 50
Sorry I can't speak English very well
I thank allThere is no need to do so in the two motions. All you need is:
select * from ( select e.*, avg(case department_id when 50 then salary end) over() dept_50_avg_sal from hr.employees e ) where salary <= dept_50_avg_sal / EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID DEPT_50_AVG_SAL ----------- -------------------- ------------------------- ------------------------- -------------------- --------- ---------- ---------- -------------- ---------- ------------- --------------- 198 Donald OConnell DOCONNEL 650.507.9833 21-JUN-07 SH_CLERK 2600 124 50 3475.55556 199 Douglas Grant DGRANT 650.507.9844 13-JAN-08 SH_CLERK 2600 124 50 3475.55556 115 Alexander Khoo AKHOO 515.127.4562 18-MAY-03 PU_CLERK 3100 114 30 3475.55556 116 Shelli Baida SBAIDA 515.127.4563 24-DEC-05 PU_CLERK 2900 114 30 3475.55556 117 Sigal Tobias STOBIAS 515.127.4564 24-JUL-05 PU_CLERK 2800 114 30 3475.55556 118 Guy Himuro GHIMURO 515.127.4565 15-NOV-06 PU_CLERK 2600 114 30 3475.55556 119 Karen Colmenares KCOLMENA 515.127.4566 10-AUG-07 PU_CLERK 2500 114 30 3475.55556 125 Julia Nayer JNAYER 650.124.1214 16-JUL-05 ST_CLERK 3200 120 50 3475.55556 126 Irene Mikkilineni IMIKKILI 650.124.1224 28-SEP-06 ST_CLERK 2700 120 50 3475.55556 127 James Landry JLANDRY 650.124.1334 14-JAN-07 ST_CLERK 2400 120 50 3475.55556 128 Steven Markle SMARKLE 650.124.1434 08-MAR-08 ST_CLERK 2200 120 50 3475.55556 EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID DEPT_50_AVG_SAL ----------- -------------------- ------------------------- ------------------------- -------------------- --------- ---------- ---------- -------------- ---------- ------------- --------------- 129 Laura Bissot LBISSOT 650.124.5234 20-AUG-05 ST_CLERK 3300 121 50 3475.55556 130 Mozhe Atkinson MATKINSO 650.124.6234 30-OCT-05 ST_CLERK 2800 121 50 3475.55556 131 James Marlow JAMRLOW 650.124.7234 16-FEB-05 ST_CLERK 2500 121 50 3475.55556 132 TJ Olson TJOLSON 650.124.8234 10-APR-07 ST_CLERK 2100 121 50 3475.55556 133 Jason Mallin JMALLIN 650.127.1934 14-JUN-04 ST_CLERK 3300 122 50 3475.55556 134 Michael Rogers MROGERS 650.127.1834 26-AUG-06 ST_CLERK 2900 122 50 3475.55556 135 Ki Gee KGEE 650.127.1734 12-DEC-07 ST_CLERK 2400 122 50 3475.55556 136 Hazel Philtanker HPHILTAN 650.127.1634 06-FEB-08 ST_CLERK 2200 122 50 3475.55556 138 Stephen Stiles SSTILES 650.121.2034 26-OCT-05 ST_CLERK 3200 123 50 3475.55556 139 John Seo JSEO 650.121.2019 12-FEB-06 ST_CLERK 2700 123 50 3475.55556 140 Joshua Patel JPATEL 650.121.1834 06-APR-06 ST_CLERK 2500 123 50 3475.55556 EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID DEPT_50_AVG_SAL ----------- -------------------- ------------------------- ------------------------- -------------------- --------- ---------- ---------- -------------- ---------- ------------- --------------- 142 Curtis Davies CDAVIES 650.121.2994 29-JAN-05 ST_CLERK 3100 124 50 3475.55556 143 Randall Matos RMATOS 650.121.2874 15-MAR-06 ST_CLERK 2600 124 50 3475.55556 144 Peter Vargas PVARGAS 650.121.2004 09-JUL-06 ST_CLERK 2500 124 50 3475.55556 180 Winston Taylor WTAYLOR 650.507.9876 24-JAN-06 SH_CLERK 3200 120 50 3475.55556 181 Jean Fleaur JFLEAUR 650.507.9877 23-FEB-06 SH_CLERK 3100 120 50 3475.55556 182 Martha Sullivan MSULLIVA 650.507.9878 21-JUN-07 SH_CLERK 2500 120 50 3475.55556 183 Girard Geoni GGEONI 650.507.9879 03-FEB-08 SH_CLERK 2800 120 50 3475.55556 186 Julia Dellinger JDELLING 650.509.3876 24-JUN-06 SH_CLERK 3400 121 50 3475.55556 187 Anthony Cabrio ACABRIO 650.509.4876 07-FEB-07 SH_CLERK 3000 121 50 3475.55556 190 Timothy Gates TGATES 650.505.3876 11-JUL-06 SH_CLERK 2900 122 50 3475.55556 191 Randall Perkins RPERKINS 650.505.4876 19-DEC-07 SH_CLERK 2500 122 50 3475.55556 EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID DEPT_50_AVG_SAL ----------- -------------------- ------------------------- ------------------------- -------------------- --------- ---------- ---------- -------------- ---------- ------------- --------------- 194 Samuel McCain SMCCAIN 650.501.3876 01-JUL-06 SH_CLERK 3200 123 50 3475.55556 195 Vance Jones VJONES 650.501.4876 17-MAR-07 SH_CLERK 2800 123 50 3475.55556 196 Alana Walsh AWALSH 650.507.9811 24-APR-06 SH_CLERK 3100 124 50 3475.55556 197 Kevin Feeney KFEENEY 650.507.9822 23-MAY-06 SH_CLERK 3000 124 50 3475.55556 37 rows selected. SQL>
SY.
-
Need help to resolve the error - below the SQL statement to execute cannot be
Below is my CO as, which creates a callable statement.
try {}
OAApplicationModule oaapplicationmodule = (webBean) pageContext.getApplicationModule;
OADBTransactionImpl t = (OADBTransactionImpl) oaapplicationmodule.getOADBTransaction ();
OracleCallableStatement proc = (OracleCallableStatement) t.createCallableStatement (lquery,-1);
proc. Execute();
t.Commit ();
}
catch (SQLException sqlexception)
{
throw OAException.wrapperException (sqlexception);
}
After the execution of the page, get the below error... (Please find below stack error)
I have referred the development guide but did not get something useful.
Please give me clues about the same.
Raghu cordially
-- Error Stack ---------------------------------------------------------
Error page
Details of the exception.
oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: Houston-27123: SQL error in the preparation of the call statement. Statement: null
at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888)
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1145)
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1408)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2637)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
in OA. jspService(OA.jsp:40)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
to EDU.oswego.cs.dl.util.concurrent.PooledExecutor$ Worker.run (PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:534)
# # 0 in detail
java.sql.SQLException: the SQL statement to execute cannot be empty or null
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:1138)
at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:1054)
at oracle.jbo.server.DBTransactionImpl.createCallableStatement(DBTransactionImpl.java:3033)
at cisco.oracle.apps.xxchr.element.server.webui.XXCHRElementSetSearchCO.processFormRequest(XXCHRElementSetSearchCO.java:343)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
in OA. jspService(OA.jsp:40)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
to EDU.oswego.cs.dl.util.concurrent.PooledExecutor$ Worker.run (PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:534)
java.sql.SQLException: the SQL statement to execute cannot be empty or null
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:1138)
at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:1054)
at oracle.jbo.server.DBTransactionImpl.createCallableStatement(DBTransactionImpl.java:3033)
at cisco.oracle.apps.xxchr.element.server.webui.XXCHRElementSetSearchCO.processFormRequest(XXCHRElementSetSearchCO.java:343)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
in OA. jspService(OA.jsp:40)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
to EDU.oswego.cs.dl.util.concurrent.PooledExecutor$ Worker.run (PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:534)
Published by: Rambeau on Oct 14, 2010 02:58check the code stuck by me again
Connection Conn = pageContext.getApplicationModule (webBean) .getOADBTransaction () .getJdbcConnection ();
Connection conn = oaapplicationmodule.getOADBTransaction().getJdbcConnection(); //Right one
Thank you
-Anil -
SQL error in the preparation of the statement, need help on coding review.
I'm analyzing a parameter to the SQL of VO statement using setWhereClause. (the idea was copied from various sources)
However, I keep getting following error.
The exception message, it seems that the SQL statement is bad. I also tried a different combination of the establishment where clause with no luck.
I use a wrong code? or is there something missing?
======================================================================
oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: 27122 Houston: SQL error in the preparation of the statement. Statement: SELECT * FROM (SELECT SalAuditEO.AUDIT_TIMESTAMP,
SalAuditEO.AUDIT_TRANSACTION_TYPE,
SalAuditEO.AUDIT_USER_NAME,
SalAuditEO.AUDIT_TRUE_NULLS,
SalAuditEO.AUDIT_SESSION_ID,
SalAuditEO.AUDIT_SEQUENCE_ID,
SalAuditEO.AUDIT_COMMIT_ID,
SalAuditEO.PAY_PROPOSAL_ID,
SalAuditEO.CHANGE_DATE,
SalAuditEO.PROPOSED_SALARY,
SalAuditEO.PROPOSED_SALARY_N,
SalAuditEO.ROWID,
PPP. ASSIGNMENT_ID
OF HUMAN RESOURCES. PER_PAY_PROPOSALS_A SalAuditEO,
GRA PER_PAY_PROPOSALS PPP
WHERE PPP. PAY_PROPOSAL_ID = SalAuditEO.PAY_PROPOSAL_ID) WHERE QRSLT (and assignment_id =: 1).
at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:891)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:603)
at oracle.apps.fnd.framework.webui.OAWebBeanTableHelper.processRequest(OAWebBeanTableHelper.java:2084)
at oracle.apps.fnd.framework.webui.beans.table.OATableBean.processRequest(OATableBean.java:1034)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:959)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2336)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1735)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:509)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:430)
in OA. jspService(OA.jsp:33)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
to EDU.oswego.cs.dl.util.concurrent.PooledExecutor$ Worker.run (PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:534)
# # 0 in detail
java.sql.SQLException: ORA-00936: lack of expression
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:583)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1144)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2548)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2933)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:650)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:578)
at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:631)
at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:518)
at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3375)
at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(OAJboViewObjectImpl.java:828)
at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4507)
at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:574)
at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:544)
at oracle.jbo.server.ViewRowSetImpl.executeDetailQuery(ViewRowSetImpl.java:619)
at oracle.jbo.server.ViewObjectImpl.executeDetailQuery(ViewObjectImpl.java:3339)
at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3326)
at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:441)
at assembly.oracle.apps.cssm.saladmin.schema.server.SalAuditVOImpl.initQuery(SalAuditVOImpl.java:21)
at assembly.oracle.apps.cssm.saladmin.schema.server.SalAuditAMImpl.initDetails(SalAuditAMImpl.java:49)
at assembly.oracle.apps.cssm.saladmin.schema.server.webui.SalAuditCO.processRequest(SalAuditCO.java:50)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:587)
at oracle.apps.fnd.framework.webui.OAWebBeanTableHelper.processRequest(OAWebBeanTableHelper.java:2084)
at oracle.apps.fnd.framework.webui.beans.table.OATableBean.processRequest(OATableBean.java:1034)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:959)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2336)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1735)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:509)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:430)
in OA. jspService(OA.jsp:33)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
to EDU.oswego.cs.dl.util.concurrent.PooledExecutor$ Worker.run (PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:534)
java.sql.SQLException: ORA-00936: lack of expression
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:583)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1144)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2548)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2933)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:650)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:578)
at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:631)
at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:518)
at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3375)
at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(OAJboViewObjectImpl.java:828)
at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4507)
at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:574)
at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:544)
at oracle.jbo.server.ViewRowSetImpl.executeDetailQuery(ViewRowSetImpl.java:619)
at oracle.jbo.server.ViewObjectImpl.executeDetailQuery(ViewObjectImpl.java:3339)
at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3326)
at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:441)
at assembly.oracle.apps.cssm.saladmin.schema.server.SalAuditVOImpl.initQuery(SalAuditVOImpl.java:21)
at assembly.oracle.apps.cssm.saladmin.schema.server.SalAuditAMImpl.initDetails(SalAuditAMImpl.java:49)
at assembly.oracle.apps.cssm.saladmin.schema.server.webui.SalAuditCO.processRequest(SalAuditCO.java:50)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:587)
at oracle.apps.fnd.framework.webui.OAWebBeanTableHelper.processRequest(OAWebBeanTableHelper.java:2084)
at oracle.apps.fnd.framework.webui.beans.table.OATableBean.processRequest(OATableBean.java:1034)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:959)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2336)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1735)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:509)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:430)
in OA. jspService(OA.jsp:33)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
to EDU.oswego.cs.dl.util.concurrent.PooledExecutor$ Worker.run (PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:534)
======================================================================
VO query: (tested OK)
SELECT SalAuditEO.AUDIT_TIMESTAMP,
SalAuditEO.AUDIT_TRANSACTION_TYPE,
SalAuditEO.AUDIT_USER_NAME,
SalAuditEO.AUDIT_TRUE_NULLS,
SalAuditEO.AUDIT_SESSION_ID,
SalAuditEO.AUDIT_SEQUENCE_ID,
SalAuditEO.AUDIT_COMMIT_ID,
SalAuditEO.PAY_PROPOSAL_ID,
SalAuditEO.CHANGE_DATE,
SalAuditEO.PROPOSED_SALARY,
SalAuditEO.PROPOSED_SALARY_N,
SalAuditEO.ROWID,
PPP. ASSIGNMENT_ID
OF HUMAN RESOURCES. PER_PAY_PROPOSALS_A SalAuditEO,
HR. PER_PAY_PROPOSALS PPP
WHERE PPP. PAY_PROPOSAL_ID = SalAuditEO.PAY_PROPOSAL_ID
Co:
' Public Sub processRequest (pageContext OAPageContext, OAWebBean webBean)
{
super.processRequest (pageContext, webBean);
SalAuditAM am = (SalAuditAM) pageContext.getApplicationModule (webBean) .findApplicationModule ("SalAuditAM"
String str1 = (String) pageContext.getSessionValue ("PerSalAssgtId");
am.initDetails (str1);
................
Am:
public void initDetails (String employeeNumber)
{
SalAuditVOImpl vo = getSalAuditVO1();
vo.initQuery (employeeNumber);
}
Vo:
public void initQuery (String paramString)
{
super.setWhereClause ("and assignment_id =: 1");
super.setWhereClauseParam (0, paramString);
super.executeQuery ();
}Hello
Copy the following code
public void initQuery (String paramString)
{
setWhereClause ("ASSIGNMENT_ID =: 1");
setWhereClauseParams (null);
setWhereClauseParam (0, paramString);
executeQuery();
}Thank you
Gerard -
Need help to set a DELETE statement.
I have a table that contains the records of files. Files come in a bouquet each week. So, we need to delete records from a table to the corresponding fields and load the table with up-to-date data.
In doing so, the DELETE statement takes a long time. Need help with this setting.
Here are the details.
(1) total number of records in the table: 23 million records.
(2) approximate records deleted each time: 500 K to 1.5 million.
(3) table is partitioned on a PERIOD key. That is, each partition will have the data for a given period.
(4) table is not indexed
(5) removal occurs on a combination of 2 fields (PERIOD + BATCH).
Here is the query and the plan:
===========================================================
SQL > EXPLAIN PLAN SET STATEMENT_ID = 'TSH' FOR
2 REMOVE / * + PARALLEL(DETAIL_UNKNOWN,10) * / u DETAIL_UNKNOWN
3 WHERE u.FLBATCHID = 'PCAFRINTERMAR1105' AND u.N_PER6 = 201214
4;
He explained.
SQL > SET LINESIZE 130
SQL > SELECT * FROM TABLE (DBMS_XPLAN. DISPLAY ('PLAN_TABLE', 'TSH', 'ALL'));
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
Hash value of plan: 2400300449
----------------------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time | Pstart. Pstop |
----------------------------------------------------------------------------------------------------
| 0 | DELETE STATEMENT. 596K | 12 M | 838 (9) | 00:00:12 |
| 1. REMOVE | DETAIL_UNKNOWN |
| 2. SIMPLE HASH PARTITION | 596K | 12 M | 838 (9) | 00:00:12 | 6. 6.
|* 3 | TABLE ACCESS FULL | DETAIL_UNKNOWN | 596K | 12 M | 838 (9) | 00:00:12 |
----------------------------------------------------------------------------------------------------
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
Name of the query block / Alias object (identified by the operation identity card):
-------------------------------------------------------------
1 LED$ 1
3 LED$ 1 / U@DEL$1
Information of predicates (identified by the operation identity card):
---------------------------------------------------
3 - filter("U".") FLBATCHID '= 'PCAFRINTERMAR1105' AND 'U'." N_PER6 "= 201214)
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
Projection of the column information (identified by the operation identity card):
-----------------------------------------------------------
2 - (cmp = 2, 3) "U". ROWID [ROWID, 10], "U". "N_PER6" [NO.22], 'U' "." " FLBATCHID ' [VARCHAR2, 20].
3 - « U ». ROWID [ROWID, 10], "U". "N_PER6" [NO.22], 'U' "." " FLBATCHID ' [VARCHAR2, 20].
27 selected lines.
===========================================================
Need your suggestions on how the query / table can be tuned.Hi Anand,
I wanted to check why your tkprof Watch report two executions of the statement:
call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Execute 2 2315.71 2480.17 0 3351 624489 611765
In fact, it there was only a single execution of the DELETE statement. The trace file begins with a call EXEC of any statement without call analysis
*** TRACE DUMP CONTINUED FROM FILE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_ora_241708.trc *** EXEC #1:c=20000,e=13996,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=0,tim=32472879711702 ===================== PARSING IN CURSOR #2 len=68 dep=0 uid=72 oct=42 lid=72 tim=32472883567994 hv=740818757 ad='0' ...
TKProf aggregates this EXEC call with call EXEC of the DELETE statement because they have the same location of cursor (#1), he thinks it was the same cursor.
PARSING IN CURSOR #1 len=93 dep=0 uid=72 oct=7 lid=72 tim=32472889974030 hv=1242910589 ad='e5979d80' DELETE from detail_unknown where n_per6 = 201214 and FLBATCHID = 'PCAFRINTERMAR1105' END OF STMT PARSE #1:c=0,e=11462,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,tim=32472889974024 ... EXEC #1:c=2315710000,e=2480213492,p=0,cr=3691,cu=624489,mis=0,r=611765,dep=0,og=1,tim=32475370187626
So, the question about two executions is closed - there was only a single run.
The performance - 2315,71 seconds of time processor is absolutely huge for such amount of work. It looks like a bug.
First, I propose to check the time without compression. If your environment allows this kind of testing try to decompress the partition and re - run on unpacking data DELETION.
10.2 find the name of the partitionselect partition_name from dba_tab_partitions where table_name = 'DETAIL_UNKNOWN' and partition_position = 6
After that
alter table DETAIL_UNKNOWN modify partition
nocompress; alter table DETAIL_UNKNOWN move partition ; and run again the button DELETE.
What is the operating system on the server?
-
Need help to identify the type of object in the loop of pl/sql
Hello
I need help to identify the Type of object declared beneath a procedure as shown below:
I need to pass the parameter to the procedure as a TYPE of OBJECT and also refer to variables of Type Object in a loop
create or replace type TEST_VALIDATION_REC is RECORD (order_num varchar2 (30),)
number of inventory_item_id
reserved_YN varchar2 (1).
error_flag varchar2 (1).
Error_message varchar2 (2000)
);
CREATE OR REPLACE TYPE VALD_TBL AS VARRAY (10000) OF TEST_VALIDATION_REC;
PROCEDURE ADD_TO_ORD)
p_lot_number_list IN VALD_TBL,
p_ord_number IN Varchar2,
p_user_id in NUMBER: = fnd_profile.value ('USER_ID'),-change 1.10
p_responsibility_id in NUMBERS: = fnd_profile.value ('RESP_ID'),-change 1.10
p_application_id IN VARCHAR2: = 'PO',-change 1.10
x_error_flag OUT Varchar2,
x_error_msg OUT Varchar2
)
In the above procedure, I had the VALD_TBL. Is it OK?
And how in the loop if the records if I use:
FOR indx1 IN 1.p_lot_number_list. COUNTY
LOOP
BEGIN
SELECT
inventory_item_id
IN
ln_item_id
Of
dummy_lot_tab
WHERE
lot_number = p_lot_number_list (indx1); - > how direct the item here?
EXCEPTION
WHILE OTHERS THEN
ln_item_id: = NULL;
END;
Records are PL/SQL objects. They are not the SQL objects. You can create a SQL TYPE (schema level) as a collection (variable-tables only, tables nested).
So therefore your first statement is syntactically incorrect
CREATE OR REPLACE TYPE TEST_VALIDATION_REC IS RECORD (order_num VARCHAR2(30), inventory_item_id NUMBER, reserved_YN VARCHAR2(1), error_flag VARCHAR2(1), Error_message VARCHAR2(2000) );
You must put in an anonymous PL/SQL block or the stored procedure
DECLARE TYPE test_validation_rec IS RECORD ( order_num VARCHAR2(30), inventory_item_id NUMBER, reserved_YN VARCHAR2(1), error_flag VARCHAR2(1), error_message VARCHAR2(2000) ); TYPE vald_tbl iS VARRAY(10000) OF test_validation_rec; lv_tbl vald_tbl; BEGIN lv_tbl := vald_tbl(); -- insert your code here END;
-
Under Update taking 2 h complete 3000 sets.
UPDATE ARR_TRANSACTIONS ARR
SET = NUMBER99
(SELECT ARR_1.NUMBER99
OF ARR_TRANSACTIONS ARR_1, ARR_HEADER BH
WHERE ARR_1.ARR_ID = BH. ARR_ID
AND BH. FLAG = "Y".
AND ARR_1.LINE_ID = ARR. ORIG_INV_LINE_ID
AND ARR_1.NUMBER9 IS NOT NULL
AND ROWNUM = 1)
WHERE ARR BATCH_ID = 26219
AND ARR. NUMBER99 IS NULL
I added more some condition where to reduce cost and its working fine. But I need to rise more than performance on SQL.
Please help with SQL.
I do not see the number of 3000 lines in the plan - so I guess that the optimizer does not compute with the correct numbers. Could generate the plan with dbms_xplan.display_cursor? This could tell us something about filter predicates and access.
In the given situation, I would check:
- is the access to the index in step 1 (filtered by the relevant conditions: this could be BATCH_ID = 26219) return actually 248 entries (or something similar)?
- Access table in step 2 returning 204 lines (or something similar) after applying the filters given? If the number of lines is much bigger then a Nested Loops is perhaps not a good idea.
To make this much simpler check, you could create a plan with statistics of content (RowSource) given that the plan containing the real and the number of estimated rows.
If the estimated cardinalities are not plausible the next question would be if the statistics are strong and up to date.
-
need help to create the insert statement
I have customer_priv of table which has 4 columns (login, privilize_id, adate, added_by)
the stmt insert like "insert into customer_priv values('JDOE',951.sysdate,admin);
I have 100 users and for each user, I need to add to the 15 privilize_id
I have the list of connections and roles, what is the best way to create a massive insert for all those users statement and
any help is very appreciated
Thank youuser11984714 wrote:
Thanks FrankI get the below now.what Miss. Also is it possible to reel in a file insert rather directly the data.am I missing values?
Sorry, I don't understand what you want.
You say you want to write something in a HOLD file instead of insert? Of course, you can do it. Change the INSERT statement in a SELECT statement and add commands to the COIL.SQL > @c:\insert_many.sql
33 old: SELECT ' & 1' priv_id, 'admin', sysdate)
33 News: SELECT sysdate, "BNELSON", "admin", priv_id)Of all_priv_id
*
ERROR on line 34:
ORA-00923: THE KEYWORD not found where expected
Thank youPublished by: user11984714 on August 9, 2010 18:40
Sorry, there was a typing error in my previous post.
Remove the ')' the end of theSELECT '&1', privilze_id, SYSDATE, 'admin')
I hope that you have more problems, but if you do, post your code, even if you think that you just copied it from this site.
-
need help with the Update statement
Hello
I received a question in a course and I tried my best to respond, and now my brain is giving. I would really appreciate help with the update statement. I don't mind if you do not validate a solution, a little nudge in the right direction would be really useful. I'll post that I got.
THE QUESTION
/ * For these agents disabled on more than seven missions, change their date of deactivation of the first date of deactivation of all the agents that have been activated in the same year as the agent that you update currently.
*/
I have it divided into parts, here is my select statement to agents disabled on more than 7 missions, which produces the deactivation_dates in the agents table that I want to update...
.. .and the code for the first date of deactivation for each year of activation agentSELECT s.deactivation_date FROM ( SELECT a.deactivation_date, count(m.mission_id) as nomissions FROM agents a INNER JOIN missions_agents m on a.agent_id=m.agent_id GROUP BY a.deactivation_date ) s WHERE s.nomissions>7 AND s.deactivation_date IS NOT NULL
..... I am not real to marry these two statements together in the Update statement. I can't extract each date of deactivation produced in the first select statement and their match against the first date of deactivation in the year they have been activated for the second select statement.select a2.deactivation_date from agents a2 where a2.deactivation_date= ( select min(a.deactivation_date) from agents a where to_number(to_char(a.activation_date,'YYYY'))=to_number(to_char(a2.activation_date,'YYYY')) )
Any help greatly appreciated... :))I began to wonder how things would :)
user8695469 wrote:
First of all why he chooses the date the earliest of all agentsUPDATE AGENTS_COPY AC /* (1) */ SET DEACTIVATION_DATE = ( SELECT MIN(AGS.DEACTIVATION_DATE) FROM AGENTS_COPY AGS , AGENTS_COPY AC /* (2) */ WHERE TRUNC(AGS.ACTIVATION_DATE,'YEAR') = TRUNC(AC.ACTIVATION_DATE,'YEAR') /* (3) */ )
He recovers as soon as the subquery has not been correctly set in the SET clause. It seems you are trying to update a correlated, but we are still having a conceptual shift. I have added a few comments to your code above and below will explain.
(1): when you do a correlated update it is useful to the table alias that you did right here.
(2): this table statement is not necessary and is the reason why the FIRST deactivation date is selected. The alias that you use (3) refers to THIS table, not the one defined in the update statement. Remove the line indicated by (2) in the FROM clause and a correlated update will happen.
and secondly why is it to update each row, when I thought that I'm just the lines where the agents are disabled and missions > 7? Pointers on where I'm wrong would be very appreciated. (SQL = stupid query language!) :)
user8695469 wrote: then why is it to update each row, when I thought that I'm just the lines where the agents are disabled and missions > 7? Pointers on where I'm wrong would be very appreciated. (SQL = stupid query language!) :)
WHERE EXISTS ( SELECT a.agent_id, count(m.mission_id) FROM agents a /* INNER JOIN AC ON AC.AGENT_ID = A.AGENT_ID */ INNER JOIN missions_agents m ON a.agent_id=m.agent_id GROUP BY a.agent_id, a.deactivation_date HAVING count(m.mission_id)>7 AND a.deactivation_date IS NOT NULL )
Once again this problem is similar to the question above that a correlation update doesn't work. Test existence of lines in an EXISTS subquery. Since your subquery is not related to the table that you are trying to update, it will be always return a line and, therefore, it returns true for EACH LINE in the AGENTS table. To limit the game to only agents > 7 missions results, you need to add a join condition that references the table in your update statement. I added one above (with comments) as a sample.
I recommend you look over all material that you have associated with correlated subqueries, including documents that I posted above. This seems to be what you're having the problem more with. If you need me to explain the concept of correlated queries any better please let me know.
Thank you!
-
With the help of a number variable in a SQL statement
Hello
I am trying to use a variable in a sql statement, and I ran into problems when the variable is a number. The following line of code works if the variable is a string, but not if it is a number.
"SELECT PAGE 1 UUT_STATUS OF UNIT_UUT_RESULT WHERE UnitID = '" + Locals.LocalUnitID + "' ORDER BY DESC START_DATE_TIME.
Is there a difference in the use of single and double quotes and the sign for numbers variables +?
Thank you
Stuart
Jervin is almost correct in the post above.
While it is correct that numbers in SQL are not enclosed in single quotes ('), we still need the entire expression to a string. If Locals.LocalUnitID is stored as a number to TestStand, you will need to cast to a string so that the string concatination works properly.
I believe that the correct form is as follows:
"SELECT PAGE 1 UUT_STATUS OF UNIT_UUT_RESULT WHERE UnitID ="+ Str (Locals.LocalUnitID) + 'ORDER BY DESC START_DATE_TIME'
Maybe you are looking for
-
My Skype number does not work! Help
summer train to call my Skype number +xxx xxx xxxx try to call all my business contacts, but he repeats to me user is busy. I dunt get it
-
Re: Satellite A200 1 M 5 blue screen & gel
I have an older A200 10 months under Vista Home Premium that came preinstalled on purchase.Since the beginning, but more regularly now, it freezes in any program several times a day and is now crashing with the blue screen to come before the dumping
-
remove the INBOXACE of Safari?
This aggravating piece of junk, keeps showing up when I click on a link. It appears in my toolbar of Safari.
-
Internal HP slate 7 voice - storage problem tab
As we know user available device memory may be less than memory declared because of the default pre-installed applications and OS device, I got 12.41 GB for use out of 16 GB. But when I checked, I found the following: It clearly shows the Total space
-
HP Director does not work on XP, I contacted HP several times with no fix. When I try to run Director nothing happens. Is there a scan inclued application under XP or office Professional 2007 can I use or downloads of microsoft? Office 5505 HP all-in