Ora-02089-COMMIT is not allowed in a subordinate session - V'urgent pls
All,
BPEL version: 11.1.1
I have to invoke a pl/sql procedure which inserts a data to a table. After insert, I used commit. When BPEL try to invoke this procedure, I got ora-02089-COMMIT is not allowed in a subordinate session+. I know without commit in pl/sql, BPEL does the commit. But for a requirement, I've to explicitly use COMMIT inside the procedure. How do I go about in this case?
Please advise.
Thanks,
Sen
IMHO.... I personally do not like using XA data sources most of the time. I can only think of a few scenarios in all my implementation where I had to undo all the 50 steps (in which case they should be a single call anyway). Mixing and matching "pragma autonomous transaction" calls with DBAdapter updates on a XA data source in a single process have gotten me into tremendous trouble and data corruption.
Also if you really have a case where you dont want to commit, I believe you can use the idempotent flag on partnerlinks to avoid the commit. There also might be cases where the PL/SQL defined as "pragma.." might be used by other non-BPEL stuff and you are just opening DB connections even when you dont need to.
Similar Messages
-
ORA-02089: COMMIT is not allowed in a subordinate session
Here is my configuration.
jdbc driver:10.2.0.3.0
EJB-CMP
Am using oracle.jdbc.xa.client.OracleXADataSource as the driver in my websphere application server 6.0.0.1.
when i am calling a stored procedure from my EJB and in the stored procedure if
i perform any DDL operation like truncate a table,create a table or commit it throws the exception:-
ORA-02089: COMMIT is not allowed in a subordinate session
please help me in solving this issue asap.hi umesh ,
i had seen this link before ,
My oracle version is 10g.still its giving the same error.
In the link yoy send they say the problem is in oracle 9i driver and it is solved in 10g .The driver version is 10.2.0.3 ,still i get the same error.
do u have any idea?
Regards,
sreenath. -
SQLException: COMMIT is not allowed in a subordinate session
My configuration:
1) IBM Websphere 5.0.2
2) database: Oracle9i release 2
3) Oracle JDBC DataSource, with XA enabled
4) driver class: oracle.jdbc.xa.client.OracleXADataSource
5) a servlet that uses JTA UserTransaction's
When I execute "DROP TABLE movies", the Oracle JDBC
driver throws a SQLException.
The exception message is
ORA-02089: COMMIT is not allowed in a subordinate session
Oracle's documentation says:
ORA-02089: COMMIT is not allowed in a subordinate session
Cause: COMMIT was issued in a session that is not the two-phase commit global coordinator.
The strange thing is that I my code does not issue a COMMIT
Also, I disabled autocommit by calling
setAutoCommit(false)
on the java.sql.Connection object.
Here is the stack trace:
[7/19/03 12:10:02:936 PDT] 587e316 SystemErr R strMsg = java.sql.SQLException: ORA-02089: COMMIT is not allowed in a subordinate session
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:579)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1894)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1094)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2132)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2015)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2877)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:925)
at com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.execute(WSJdbcStatement.java:299)
at foobar.movie.MovieUtil.setupMovieTable(MovieUtil.java:66)I resolved this issue.
If you are using an Oracle XA DataSource, Oracle's
JDBC driver will automatically issue a COMMIT
when it sees a "DROP TABLE foobar" statement.
Oracle's JDBC driver cannot properly execute a
DROP TABLE statement unless you are using a non-XA DataSource.
With a non-XA Oracle DataSource, I can happily execute "DROP TABLE foobar" -
COMMIT is not allowed in a subordinate session
In My Servlet, I am using JTA transaction which is not a CMT.
I am running this on Oracle XADatasource.
When I'm trying to perform the DB operation, I'm getting the
Exception saying "COMMIT is not allowed in a subordinate session "
My Servlet code is :
public class BatchServlet extends javax.servlet.http.HttpServlet implements
javax.servlet.Servlet {
PrintWriter out = null;
@PersistenceUnit(unitName="PERUNIT")
EntityManagerFactory emf;
EntityManager em;
@Resource
UserTransaction utx;
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
out = response.getWriter();
try {
initEM();
utx.begin();
updateDB();
utx.commit();
} catch (Exception ex) {
ex.printStackTrace(out);
utx.rollback();
} finally {
closeEM();
public void initEM() throws Exception {
em = emf.createEntityManager();
public void closeEM() {
if (em != null) {
em.close();
private void updateDB() throws Exception {
Address address = em.find(Address.class, 50030L);
out.println("County :: " + address.getCounty());
address.setBuildingNumber("Building # ABC");
em.persist(address);
out.println("Before Flush");
em.flush();
out.println("After Flush");
public BatchServlet() {
super();
}My Persistence.xml is
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="PERUNIT" transaction-type="JTA">
<provider> org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>MYXADS</jta-data-source>
<class> com.test.Address</class>
<properties>
<property name="eclipselink.logging.level" value="CONFIG"/>
<property name="javax.persistence.jtaDataSource" value="jdbc/MYXADS"/>
<property name="eclipselink.logging.level" value="FINE"/>
</properties>
</persistence-unit>
</persistence>What if, in stead of using the UserTransaction, you simply use em.getTransaction().begin() and em.getTransaction().commit() to start / end the transaction? It seems to me the UserTransaction object represents a completely different transaction environment than your entity manager wants to use.
-
ORA-30563, Outer Join not allowed in select list
I can not find any information about this error message that I am getting.
I have just upgraded my Oracle database from Version 7.3 to Version 8.1.7, a stored procedure that was written in v7.3 has outer joins in the select statement.
when trying to run this proc in version 8 I get this meesage.(ORA-30563, Outer Join not allowed in select list)
code ex:
Select alt.id
decode(alt.advise, NULL, NULL, AA.act_yr(+))||'-'||AA.act_per(+)||'-'||AA.Acc_per_no(+)) as advise_no
from alt, AA;
Is there any information about this message anywhere? or does anybody know if this is a known issue with oracle ver 8.1.7?
Thanks
CJIt appears to have been a bug in 7.x
From a metalink note on bugs fixed in 8i (doc 132632.1)
974742 Oracle does not report an error if (+) is specified in select-list. The OUTER JOIN operator (+) is only valid in WHERE clause predicates. As this is not flagged as an error the query can give unexpected results. The correct action to avoid this problem is to fix the query.
Ken -
ORA-01733- virtual column not allowed here - Insert using inline view
Does anyone know why I am getting ORA-01733- virtual column not allowed here
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
---no error without WITH CHECK option
SQL> INSERT INTO
2 (SELECT
3 location_id,
4 city,
5 l.country_id
6 FROM countries c, locations l,regions r
7 where l.country_id = c.country_id
8 and r.region_id=c.region_id
9 and r.region_name = 'Asia')
10 VALUES (5500, 'Wansdworth Common', 'UK');
1 row created.
SQL> rollback;
Rollback complete.
-----error with WITH CHECK OPTION
SQL> INSERT INTO
2 (SELECT
3 location_id,
4 city,
5 l.country_id
6 FROM countries c, locations l,regions r
7 where l.country_id = c.country_id
8 and r.region_id=c.region_id
9 and r.region_name = 'Asia' WITH CHECK OPTION)
10 VALUES (5500, 'Wansdworth Common', 'UK');
INSERT INTO
ERROR at line 1:
ORA-01733: virtual column not allowed here
I was expecting
ORA-01402: view WITH CHECK OPTION where-clause violation
for the second one. Is there anything I am missing here ?Randolf
Thank you very much for the update to this old question
After reading the link I think I should ignore this error and accept it as ORA-01402
The information you asked me to check did not lead me an understanding of different error types.
SQL> ----view for ORA-01733
SQL> create view test_v_1
2 as
3 SELECT
4 location_id,
5 city,
6 l.country_id
7 FROM countries c, locations l,regions r
8 where l.country_id = c.country_id
9 and r.region_id=c.region_id
10 and r.region_name = 'Asia' WITH CHECK OPTION;
View created.
SQL>
SQL>
SQL>
SQL> select * from user_updatable_columns where table_name='TEST_V_1';
OWNER TABLE_NAME COLUMN_NAME UPD INS DEL
HR TEST_V_1 CITY YES YES YES
HR TEST_V_1 COUNTRY_ID NO NO NO
HR TEST_V_1 LOCATION_ID YES YES YES
SQL>
SQL> ----view for ORA-01402
SQL>
SQL> create view test_v_2
2 as
3 SELECT
4 d.department_id,
5 d.department_name,
6 d.location_id
7 FROM hr.departments d,hr.locations l
8 WHERE l.location_id=d.location_id
9 and d.location_id < 2000
10 WITH CHECK OPTION;
View created.
SQL>
SQL> select * from user_updatable_columns where table_name='TEST_V_2';
OWNER TABLE_NAME COLUMN_NAME UPD INS DEL
HR TEST_V_2 DEPARTMENT_ID YES YES YES
HR TEST_V_2 DEPARTMENT_NAME YES YES YES
HR TEST_V_2 LOCATION_ID NO NO NO
SQL>
SQL>
SQL> ----INSERT STILL FAILING WITH DIFFERENT ERROR DESPITE THE SAME UPDATABLE COLUMN STRUCTURE
SQL> insert into test_v_1 values (5500, 'Wansdworth Common', 'UK');
insert into test_v_1 values (5500, 'Wansdworth Common', 'UK')
ERROR at line 1:
ORA-01733: virtual column not allowed here
SQL> insert into test_v_2 values (9999, 'Entertainment', 2500);
insert into test_v_2 values (9999, 'Entertainment', 2500)
ERROR at line 1:
ORA-01402: view WITH CHECK OPTION where-clause violation
SQL>A. Coskan GUNDOGAR
Oracle DBA
http://coskan.wordpress.com
“A man's errors are his portals of discovery.”
James Joyce -
ORA-02253: constraint specification not allowed here
I'm trying to create a table clients with primairy key, but I'm getting the error "ORA-02253: constraint specification not allowed here"
if anyone call what to do
CREATE TABLE CLIENTS
NUMERO NUMBER(6) CONSTRAINT PK_CLIENTS PRIMAIRY KEY,
NOM VARCHAR(63), NOT NULL,
PRENOM VARCHAR(63),
NAISSANCE DATE
Edited by: user10397656 on Oct 13, 2008 1:40 AMThere are some errors in your script :
PK_CLIENTS PRIMAIRY KEY
and
NOM VARCHAR(63)*,* NOT NULL,
Try this way
CREATE TABLE CLIENTS
NUMERO NUMBER(6) CONSTRAINT PK_CLIENTS PRIMARY KEY,
NOM VARCHAR(63) NOT NULL,
PRENOM VARCHAR(63),
NAISSANCE DATE
); -
Received ORA-22818 subquery expressions not allowed here when creating mate
Hello,
I was trying to create a materialized view to describe the referential integrity between the tables in my schema:
create materialized view user_references
tablespace tbspc
build immediate
using index
refresh complete on demand next sysdate + 1
as
select uic.table_name to_table, uic.column_name to_column,
ucc.table_name from_table, ucc.column_name from_column
from user_ind_columns uic, user_constraints uc, user_cons_columns ucc
where uic.index_name = uc.r_constraint_name
and uc.constraint_name = ucc.constraint_name
and uc.owner=upper('my_schema');
I was able to create this MV in Oracle 9.2. It failed with the following error when I ran it against Oracle 10.1:
from user_ind_columns uic, user_constraints uc, user_cons_columns ucc
ERROR at line 9:
ORA-22818: subquery expressions not allowed here
Is not allowing subqueries in MV a new restriction in Oracle 10? Is there a workaround?
ThanksHello
This may be a bug in your version as I can do it successfully on 10.2
tylerd@DEV2> create materialized view user_references
2 build immediate
3 using index
4 refresh complete on demand next sysdate + 1
5 as
6 select uic.table_name to_table, uic.column_name to_column,
7 ucc.table_name from_table, ucc.column_name from_column
8 from user_ind_columns uic, user_constraints uc, user_cons_columns ucc
9 where uic.index_name = uc.r_constraint_name
10 and uc.constraint_name = ucc.constraint_name
11 and uc.owner=upper('my_schema');
Materialized view created.
tylerd@DEV2> select * from v$version
2 /
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
PL/SQL Release 10.2.0.2.0 - Production
CORE 10.2.0.2.0 Production
TNS for 32-bit Windows: Version 10.2.0.2.0 - Production
NLSRTL Version 10.2.0.2.0 - Production
5 rows selected.HTH
David -
Hi guys, I m facing a problem while executing below query .Query is working fine in toad i don't know what is the issue with the code
<code>
String url3 = "CREATE OR REPLACE VIEW Table2(PERIOD, YEARS, COST_CENTRE, S_DIR_PERM, S_DIR_CONT, S_INDIR_PERM, S_INDIR_CONT, O_DIR_PERM, O_DIR_CONT, O_INDIR_PERM, O_INDIR_CONT)AS select period, year, cost_center, sum(s_dir_perm), sum(s_dir_cont), sum(s_indir_perm), sum(s_indir_cont), sum(o_dir_perm), sum(o_dir_cont), sum(o_indir_perm), sum(o_indir_cont) from ( select b.period, b.year, a.cost_center, sum(a.perm_dir_hc) as s_dir_perm, sum(a.contract_dir_hc) as s_dir_cont, sum(a.perm_indir_hc) as s_indir_perm, sum(a.contract_indir_hc) as s_indir_cont, 0 as o_dir_perm, 0 as o_dir_cont, 0 as o_indir_perm, 0 as o_indir_cont from ZVHR_ACT_HC_ASOF_FISPRD a, pertable b where to_char(as_of_date, 'mm/dd/yyyy') = b.ENDPERIOD and shift not in ('G','N','O2','O7') and b.endperiod = ? group by b.period, b.year, a.cost_center union select b.period, b.year, a.cost_center, 0 as s_dir_perm, 0 as s_dir_cont, 0 as s_indir_perm, 0 as s_indir_cont, sum(a.perm_dir_hc) as o_dir_perm, sum(a.contract_dir_hc) as o_dir_cont, sum(a.perm_indir_hc) as o_indir_perm, sum(a.contract_indir_hc) as o_indir_cont from ZVHR_ACT_HC_ASOF_FISPRD a, pertable b where to_char(as_of_date, 'mm/dd/yyyy') = b.ENDPERIOD and shift in ('G','N','O2','O7') and b.endperiod = ? group by b.period, b.year, a.cost_center) group by period, year, cost_center";
PreparedStatement statement3 = connection.prepareStatement(url3);
statement3.setString(1, "12/10/2008");
statement3.setString(2, "12/10/2008");
statement3.addBatch();
statement3.executeBatch();
</code>
i m getting the following error
java.sql.BatchUpdateException: ORA-01027: bind variables not allowed for data definition operations
can any1 help me with this.Can you explain what you are trying to do from a business perspective?
If you are creating a view, it doesn't make sense to pass bind variables to that DDL statement. The view definition itself is going to have to end up with hard coded date values there. So what possible benefit is there to using bind variables?
As an aside, if you are using bind variables and you have DATE columns, you really want to pass in the proper data type (i.e. setDate or setTimestamp rather than setString). Otherwise, Oracle has to do implicit string to date conversion, which depends on the session's NLS settings, which is likely to be different on different client machines and lead to all sorts of odd errors and behaviors down the line.
Are you trying to build a view that takes parameters? If so, there are a few options for that sort of thing.
Justin -
Dear All,
How to disable Refresh,Reload in browser and end user should not allow to multiple browser sessions in portal.Where we need to configure the settings or any code in masthead or any other component. My server version is 7.4 - SP5 .Please help us.
Thanks for advance,
BR,
Durga Rao.Dear all,
i am able to logoff the click refresh button on keyboard.I am using this code to log off the user into the portal.
document.onkeydown = function(e)
var key;
if (window.event) key = event.keyCode
else
var unicode = e.keyCode ? e.keyCode : e.charCode
key = unicode
switch (key)
{ //event.keyCode
case 116: //F5 button
LSAPI.sessionPlugin.logoff();
event.returnValue = false;
key = 0; //event.keyCode = 0;
return false;
case 82: //R button
if (event.ctrlKey)
LSAPI.sessionPlugin.logoff();
event.returnValue = false;
key = 0; //event.keyCode = 0;
return false;
case 91: // ctrl + R Button
LSAPI.sessionPlugin.logoff();
event.returnValue= false;
key=0;
return false;
Thanks.
But i am unable to control the multiple windows opening the browser.So any one can tell me the how to block the new window and new tab/duplicate tab option.
BR,
Durga Rao. -
EA4500 would not allow web GUI mgmt session any longer?
Hi everyone,
The strangest thing -- EA4500 would not allow web GUI mgmt session any longer?
It worked just fine for 6 moths; now if I try to manage it using the web gui it would authenticate fine but right after correct password is entered it will sit with the little spinning wheel forever:
Remedies that did NOT work:
1. Rebooted several times
2. Flashed firmware using the tool FW_EA4500_2.1.39.145204.SSA.zip
3. Tried several different browsers
4. Same as number 3 above but from another laptop
Otherwise the router's functions are 100% operational; both wireless and hard-wired; works; performance is as expected in terms of speed; port forwarding works; lights work as expected.
So what's left? I really would like to avoid reset to factury configuration as I have ton of settings which I didn't ducoment back in the day when it was installed.
Thanks everyone for your suggestions!Hi bbiandov,
You may disconnect your modem from the router and try to access the user interface again. If you can't access the page still, you may need to reset the router and reconfigure it.
Help, learn and share -
ORA-22902 CURSOR expression not allowed Error Cause: CURSOR on a subquery..
Hi,
I found same issue in a metalink thread which is addressed in Oracle 12.1 which doesn't help me now. I need to rewrite the below query. Does anyone have any suggestions how to go about it?
thanks,
April
working in Oracle 11.2.0.3.1, windows server, doing an upgrade from 10g to 11g. Piece of code is failing with following error via TOAD
Oracle Database Error Code ORA-22902 Description :
CURSOR expression not allowed
Error Cause:
CURSOR on a subquery is allowed only in the top-level SELECT list of a query.
The below code is returning a tree of data for projects, units within the buildings.
Code as follows:
SELECT LEVEL
, p.project_id
|| NVL (p.file_ref, ' ')
|| '] ['
|| NVL (p.project_ref, ' ')
|| '] '
|| p.project_name
|| ' ( '
|| (SELECT COUNT (*)
FROM PROJECT p1
WHERE p1.parent_project_id = p.project_id)
|| ' sub-projects, '
|| (SELECT COUNT (*)
FROM PROJECT_ELEMENT pe2
WHERE pe2.project_id = p.project_id)
|| ' elements)' AS project_description
CURSOR
(SELECT pe.element_id
|| pe.element_ref
|| '] '
|| pe.element_name
|| ' ('
|| pe.unit_count
|| ')' AS element_description
CURSOR
(SELECT hu.hu_id
|| hu.hu_ref
|| '] '
|| CASE
WHEN hu.bedroom_count IS NOT NULL
THEN ', Bedrooms: ' || hu.bedroom_count
ELSE NULL
END
|| CASE
WHEN hu.bedspace_count IS NOT NULL
THEN ', Bedspaces: ' || hu.bedspace_count
ELSE NULL
END AS hu_descripton
FROM HOUSING_UNIT hu
WHERE hu.element_id = pe.element_id
ORDER BY hu.hu_ref
) AS housing_units
FROM PROJECT_ELEMENT pe
WHERE pe.project_id = p.project_id
ORDER BY pe.element_ref, pe.element_name
) elements
FROM PROJECT p
START WITH p.project_id = l_root_project_id
CONNECT BY PRIOR p.project_id = p.parent_project_id -- connect by used with LEVEL keyword
ORDER SIBLINGS BY p.file_ref DESC
, p.project_ref DESC
, p.project_name DESC;
Edited by: AprilM on Jul 17, 2012 10:28 AMInteresting. I am getting even worse results on 11.2.0.1.0:
SQL> select * from v$version
2 /
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> select dname,cursor(select ename from emp e where e.deptno = d.deptno) from dept d
2 /
select dname,cursor(select ename from emp e where e.deptno = d.deptno) from dept d
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-00905: missing keyword
SQL> connect scott
Enter password: *****
Connected.
SQL> select * from v$version
2 /
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL> select dname,cursor(select ename from emp e where e.deptno = d.deptno) from dept d
2 /
DNAME CURSOR(SELECTENAMEFR
ACCOUNTING CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
ENAME
CLARK
KING
MILLER
RESEARCH CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
ENAME
SMITH
JONES
SCOTT
ADAMS
FORD
SALES CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
ENAME
ALLEN
WARD
MARTIN
BLAKE
TURNER
JAMES
6 rows selected.
OPERATIONS CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
no rows selected
SQL> And double CURSOR also works fine in 10g:
SQL> select cursor(select dname,cursor(select ename from emp e where e.deptno = d.deptno) from dept d) from dual
2 /
CURSOR(SELECTDNAME,C
CURSOR STATEMENT : 1
CURSOR STATEMENT : 1
DNAME CURSOR(SELECTENAMEFR
ACCOUNTING CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
ENAME
CLARK
KING
MILLER
RESEARCH CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
ENAME
SMITH
JONES
SCOTT
ADAMS
FORD
SALES CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
ENAME
ALLEN
WARD
MARTIN
BLAKE
TURNER
JAMES
6 rows selected.
OPERATIONS CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
no rows selectedSY.
Edited by: Solomon Yakobson on Jul 17, 2012 1:27 PM -
ORA-22818: subquery expressions not allowed here
I am currently optimizing my report. Before, this report has only a single query for all. But when I have revised it having subquery it is performing much more faster. The problem is, I cannot perform a calculation on my query since subquery expressions are not allowed in 'group by'. Heres my sample report:
SELECT ab.batch_name,
ai.invoice_amount,
ai.invoice_date,
ai.invoice_num,
ai.invoice_id,
(SELECT pv.vendor_name
FROM apps.po_vendors pv
WHERE pv.vendor_id = ai.vendor_id)vendor_name,
aid.distribution_line_number,
SUM(aid.amount * (atc.tax_rate/100))amount,
(SELECT gcc.segment2
FROM apps.gl_code_combinations gcc
WHERE gcc.code_combination_id = aid.dist_code_combination_id)segment2,
(SELECT gcc.segment5
FROM apps.gl_code_combinations gcc
WHERE gcc.code_combination_id = aid.dist_code_combination_id)segment5
FROM apps.ap_batches_all ab,
apps.ap_invoices_all ai,
apps.ap_invoice_distributions_all aid,
apps.ap_awt_groups aag,
apps.ap_tax_codes_all atc
WHERE ab.batch_id = ai.batch_id
AND ai.invoice_id = aid.invoice_id
AND aag.group_id = aid.awt_group_id
GROUP BY ab.batch_name,
ai.invoice_amount,
ai.invoice_date,
ai.invoice_num,
ai.invoice_id,
(SELECT pv.vendor_name
FROM apps.po_vendors pv
WHERE pv.vendor_id = ai.vendor_id),
aid.distribution_line_number,
(SELECT gcc.segment2
FROM apps.gl_code_combinations gcc
WHERE gcc.code_combination_id = aid.dist_code_combination_id),
(SELECT gcc.segment5
FROM apps.gl_code_combinations gcc
WHERE gcc.code_combination_id = aid.dist_code_combination_id)
Can anyone advise on what to do? I really need the computation part but at the same time I would like to optimize my report using subqueries.You dont need to group by the actual inline SQL/sub-query but only the columns you used from the main query ( ie, aid.dist_code_combination_id, ai.vendor_id )
You also have to make sure that the in-line SQL you are using will return not more than 1 row.
Also, why not just use a normal join (or outer join if necessary)? -
ORA-02287 sequence number not allowed here
Hello
Could someone tell my why I get this error with the following select?
create sequence dt_test_seq start with 1 increment by 1;
create table dt_test_tab (col1 number,col2 number, col3 number);
insert into dt_test_tab values(1,1,1);
insert into dt_test_tab values(1,1,1);
insert into dt_test_tab values(1,2,2);
insert into dt_test_tab values(2,2,3);
insert into dt_test_tab values(2,2,3);
select
col1,
col2,
col3,
NVL(next_val,LAG(next_val) over(partition by col1,col2 order by col1,col2))
from
select
col1,
col2,
col3,
CASE
WHEN row_number() over (partition by col1,col2 order by col1,col2) = 1 THEN
dt_test_seq.nextval
END next_val
FROM
dt_test_tab
);I came across the problem while trying to come up with a single query answer to the post:Re: Call a function only on change of group of columns
The inner query works fine but the error comes when it is turned into an inline view and apply a function to the next_val column.
It's more out of curiosity than anything else as the answer that dmitry posted is obviously the right way to do it?
And yes, I am very bored ;-)
DavidSQL> create function getnextval return number
2 is
3 id number;
4 begin
5 select dt_test_seq.nextval into id from dual;
6 return id;
7 end;
8 /
Function created.
SQL> edit
Wrote file afiedt.buf
1 select
2 col1,
3 col2,
4 col3,
5 CASE
6 WHEN row_number() over (partition by col1,col2 order by col1,col2) = 1 THEN
7 getnextval
8 END next_val
9 FROM
10* dt_test_tab
SQL> /
COL1 COL2 COL3 NEXT_VAL
1 1 1 99
1 1 1
1 2 2 100
2 2 3 101
2 2 3
SQL> edit
Wrote file afiedt.buf
1 select
2 col1,
3 col2,
4 col3,
5 NVL(next_val,LAG(next_val) over(partition by col1,col2 order by col1,col2)) next_v
6 from
7 (
8 select
9 col1,
10 col2,
11 col3,
12 CASE
13 WHEN row_number() over (partition by col1,col2 order by col1,col2) = 1 THEN
14 getnextval
15 END next_val
16 FROM
17 dt_test_tab
18* )
SQL> /
COL1 COL2 COL3 NEXT_V
1 1 1 105
1 1 1 105
1 2 2 106
2 2 3 107
2 2 3 107
Is it what you need ?
Rgds.
But I am afraid it's not what you need, am I not ? -
Variable exit not taking multiple single values...urgent pls
Hi BW Guru's
I have created an variable exit where the variable represents mulitple single values.
In the customer exit when i trying to populate mulitiple values and move it to e_t_range it is not taking multiple values. I have also observed that it is a line item type. I want to know if there is anyway out since it is an urgent requirement. Any help would highly appreciated. I shall also award points accordingly. Thanks.Hi Anil,
Thanks for your prompt response.
I guess i am missing out some thing.
The scenaio is like this I want to hard code some values which have to be removed from the selection hence I have created the variable with multiple single value variable and I have removed (unchecked) ready for input as it is not required. After your suggestion I have also made it mandatory but after running the query I am getting a message Abort no value determined. I have written this code under if i_step = 1.
My code goes like this .
DATA: BEGIN OF I_SO_VENDNO occurs 0,
SOURCSYS TYPE /BIC/TZSO_VEND-/BIC/ZSOURCSYS,
ZSO_VEND TYPE /BIC/TZSO_VEND-/BIC/ZSO_VEND,
TXTMD TYPE /BIC/TZSO_VEND-TXTMD,
END OF I_SO_VENDNO.
select * from /BIC/TZSO_VEND into table i_so_vendno.
loop at i_so_vendno where TXTMD CS 'GREAT LAKES'.
l_s_range-low = i_so_vendno-zso_vend.
l_s_range-sign = 'I'.
l_s_range-opt = 'NE'.
append l_s_range to e_t_range.
clear: e_t_range, l_s_range, i_so_vendno.
endloop.
Want to know if I am missing out something.
Thanks.
Maybe you are looking for
-
Sometimes when I click the icon, it won't start and other times it will.
I click the icon in the bottom left (once) but Mozilla never comes up. I right click and select open on the icon in the left of the desktop, but Mozilla doesn't open. I go to "programs" [on windows 7], select Mozilla, but it doesn't open. This doesn'
-
Can you have an allowance account without a monthly allowance?
My goal is to find out if I could I create a new allowance (not based on an existing iTunes Store account), that would end up having no monthly allowance? I would use this account to gift apps to it and there would be no monthly build up of iTunes st
-
I need to learn how to add a page at the end of my video to put credits?
I am editing for the first time EVER and need to know how to add credits to the end of a video
-
Hello - can anyone tell me how you set the dimensions of a flash paper file (.swf) when loading it into a movie? It seems to default at 550x400. Thanks
-
This is actually a two part question. First - I need to upgrade a wireless controller 4402 and I need update boot loader and software. Can I do both at the same time? Second - How can I prevent the APS from failing over when I reboot with out having