ORE: invalid cost.matrix column names
I am trying to use the odmDT method with applying custom costs like so:
> dt.mod = ore.odmDT(default ~ .,credit_train,max.depth=20,cost.matrix=matrix(c(0,1,4,0),nrow=2)
but I get the error:
Error in ore.odmDT(default ~ ., credit_train, max.depth = 20, cost.matrix = error_cost) :
ORE: invalid cost.matrix column names
I can't find any documentation anywhere on how exactly this cost matrix needs to be specified.
Any help would be appreciated
The value for cost.matrix currently requires a data frame object. The following examples using the NARROW data successfully pass a data frame for the value of cost.matrix:
R> NARROW.costs.gender <- data.frame(ACTUAL_TARGET_VALUE = c("M","F","M","F"),
PREDICTED_TARGET_VALUE = c("M","M","F","F"),
COST = c(0.0, 0.25, 0.75, 0.0))
R> NARROW.costs.class <- data.frame(ACTUAL_TARGET_VALUE = c(0,1,0,1),
PREDICTED_TARGET_VALUE = c(0,0,1,1),
COST = c(0.0, 0.25, 0.75, 0.0))
R> dt.mod1 <- ore.odmDT(GENDER ~ ., NARROW, cost.matrix=NARROW.costs.gender)
summary(dt.mod1)
R> dt.mod2 <- ore.odmDT(CLASS ~ ., NARROW, cost.matrix=NARROW.costs.class)
summary(dt.mod2)
I've filed a bug so this behavior may be evaluated for a future Oracle R Enterprise release.
Similar Messages
-
ADF BC View object with invalid character in column names
Hello
I Have a table with columns containing # character , for example ORDER# , When i create the read only view object j developer automatically renames this to order, but when i try to sort on that column or try search (filter) i get error that column order is not found
what i can change to resolve this
Thanks for your time
SrinivasThanks frank i will do that , as a work around , the error is resolved by changing the query from select order# , other fields to select order# as ordernumber etc
Thanks
Srinivas -
How To Create Table View With Same Column name But Different Table?
Hi All,
I have the problem to create a tableview with same column name but in different table.
The Table that i have:-
Table - PAC051MPROFORMA
Column - mrn,visitid
Table - PAC051TPROFORMA
Column - mrn,visitid
Table - PAC052MTRANSBILL
Column - mrn,visitid
Then i want to create a table view to view that table. This is my SQL
CREATE VIEW pacviewproforma (mrn,visitid,mrn,visitid,mrn,visitid)
As Select PAC051MPROFORMA.mrn,PAC051MPROFORMA.visitid,PAC051TPROFORMA.mrn,PAC051TPROFORMA.visitid,PAC052MTRANSBILL.mrn,PAC052MTRANSBILL.visitid
where
*(a.PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)*
and
*(a.PAC051TPROFORMA.mrn=PAC052TRANSBILL.mrn)*
That SQL Return this error = ORA-00957: duplicate column name
Then I modify that SQL to
CREATE VIEW pacviewproforma (mrn,visitid)
As Select PAC051MPROFORMA.mrn,PAC051MPROFORMA.visitid,PAC051TPROFORMA.mrn,PAC051TPROFORMA.visitid,PAC052MTRANSBILL.mrn,PAC052MTRANSBILL.visitid
where
*(a.PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)*
and
*(a.PAC051TPROFORMA.mrn=PAC052TRANSBILL.mrn)*
This time this error return = ORA-01730: invalid number of column names specified
What should i do?
Thanks...Hi,
SQL> CREATE VIEW pacviewproforma (mrn,visitid,mrn,visitid,mrn,visitid)
2 As Select
3 PAC051MPROFORMA.mrn,
4 PAC051MPROFORMA.visitid,
5 PAC051TPROFORMA.mrn,
6 PAC051TPROFORMA.visitid,
7 PAC052MTRANSBILL.mrn,
8 PAC052MTRANSBILL.visitid
9 from PAC051MPROFORMA,PAC051TPROFORMA,PAC052MTRANSBILL
10 where
11 (PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)
12 and
13 (PAC051TPROFORMA.mrn=PAC052MTRANSBILL.mrn);
CREATE VIEW pacviewproforma (mrn,visitid,mrn,visitid,mrn,visitid)
ERROR at line 1:
ORA-00957: duplicate column namePlease give different names to each column.
Something like this..
SQL> CREATE OR REPLACE VIEW pacviewproforma (MPROFORMA_mrn,MPROFORMA_visitid,TPROFORMA_mrn,TPROFORMA
_visitid,MTRANSBILL_mrn,MTRANSBILL_visitid)
2 As Select
3 PAC051MPROFORMA.mrn,
4 PAC051MPROFORMA.visitid,
5 PAC051TPROFORMA.mrn,
6 PAC051TPROFORMA.visitid,
7 PAC052MTRANSBILL.mrn,
8 PAC052MTRANSBILL.visitid
9 from PAC051MPROFORMA,PAC051TPROFORMA,PAC052MTRANSBILL
10 where
11 (PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)
12 and
13 (PAC051TPROFORMA.mrn=PAC052MTRANSBILL.mrn);
View created.
SQL> DESC pacviewproforma;
Name Null? Type
MPROFORMA_MRN NUMBER
MPROFORMA_VISITID NUMBER
TPROFORMA_MRN NUMBER
TPROFORMA_VISITID NUMBER
MTRANSBILL_MRN NUMBER
MTRANSBILL_VISITID NUMBER
ORA-01730: invalid number of column names specifiedThe list of column nmae you specified during the CREATE VIEW should match with the SELECT list of the view.
Twinkle -
Invalid column name for Transparent Gateway for SQLServer
I have successfully set up a transparent gateway for an MS SQLServer database 'pubs' from Oracle 910. I am able to run the following statement successfully as it returns all results without a hitch:
select * from authors@pubs;
pubs is the database link for the transparent gateway.
But when I select any particular column in the select statement like:
select city from authors@pubs;
I get the following error:
select city from authors@pubs
ERROR at line 1:
ORA-00904: invalid column name
Can anyone help me with this?
ThanksSamarjit,
This should work. Are you using a certified configuration?
Check our certification matrix at http://otn.oracle.com/products/gateways/pdf/certmatrix2.pdf
Vira -
ORA-00904: invalid column name in select query by using abstract datatype
Hi,
I had created abstract datatype as PERSON_TY and ADDRESS_TY ,
after inserting the record . i'm tryng to select the column but i got the error , even i refferd all those thing. they are given that same please look this finde me a result.
SQL> DESC PERSON_TY
Name Null? Type
NAME VARCHAR2(25)
ADDRESS ADDRESS_TY
SQL> DESC ADDRESS_TY
Name Null? Type
STREET VARCHAR2(30)
CITY VARCHAR2(25)
STATE CHAR(2)
COUNTRY VARCHAR2(15)
SQL> SELECT * FROM EMPLOYE
2 ;
EMP_CODE
PERSON(NAME, ADDRESS(STREET, CITY, STATE, COUNTRY))
10
PERSON_TY('VENKAT', ADDRESS_TY('112: BLUE MOUNT', 'CHENNAI', 'TN', 'INDIA'))
20
PERSON_TY('SRINI', ADDRESS_TY('144: GREEN GARDEN', 'THAMBARAM', 'TN', 'INDIA'))
SQL> SELECT PERSON.NAME FROM EMPLOYE
2 ;
SELECT PERSON.NAME FROM EMPLOYE
ERROR at line 1:
ORA-00904: invalid column name
regards
venkiSELECT PERSON.NAME FROM EMPLOYEIf you look in the documentation, you will see that we need to alias the table in order to make this work:
select e.person.name from employees e
/Cheers, APC
Blog : http://radiofreetooting.blogspot.com -
Invalid column name in WLS 6.1 sp4
We have been using WLS 6.1 sp2 with toplink and never had any problems. Recently
we migrated to sp4 and get a invalid column name exception while updating records.
For select queries there is no error. The SQL generated by toplink is -
UPDATE PR_SUPP SET CNTC_PRSN_NAME = ''
, REMK = 'Remark 123', LAST_CHNG_DTTM = {ts '2002-11-29 10:59:56.0'} WHERE ((S
UPP_CODE = 'A0001') AND (LAST_CHNG_DTTM = {ts '2002-11-29 10:46:01.0'}))
It looks like some problem with the JDBC driver. The databse is Oracle 8.17. How
to fix it
The exception stack trace is -
2002-11-27 11:56:25,763 ERROR com.pws.ubiquity.pr.business.TransactionTypeFacade
- Error while commiting transaction (creating TransactionType):LOCAL EXCEPTION
STACK:
EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.DatabaseException
EXCEPTION DESCRIPTION: java.sql.SQLException: ORA-00904: invalid column name
INTERNAL EXCEPTION: java.sql.SQLException: ORA-00904: invalid column name
ERROR CODE: 904
at oracle.toplink.exceptions.DatabaseException.sqlException(Unknown Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(Unknown
Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeNoSelect(Unknown
Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(Unknown
Source)
at oracle.toplink.publicinterface.UnitOfWork.executeCall(Unknown Source)
at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown
Source)
at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown
Source)
at oracle.toplink.internal.queryframework.CallQueryMechanism.insertObject(Unknown
Source)
at oracle.toplink.internal.queryframework.StatementQueryMechanism.insertObject(Unknown
Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(Unknown
Source)
at oracle.toplink.queryframework.InsertObjectQuery.executeCommit(Unknown Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.performUserDefinedWrite(Unknown
Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.performUserDefinedInsert(Unknown
Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(Unknown
Source)
at oracle.toplink.queryframework.WriteObjectQuery.executeCommit(Unknown Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.executeWrite(Unknown
Source)
at oracle.toplink.queryframework.WriteObjectQuery.execute(Unknown Source)
at oracle.toplink.queryframework.DatabaseQuery.execute(Unknown Source)
at oracle.toplink.publicinterface.Session.internalExecuteQuery(Unknown Source)
at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(Unknown Source)
at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
at oracle.toplink.internal.sessions.CommitManager.commitAllObjects(Unknown Source)
at oracle.toplink.publicinterface.Session.writeAllObjects(Unknown Source)
at oracle.toplink.publicinterface.UnitOfWork.commitToDatabase(Unknown Source)
at oracle.toplink.publicinterface.UnitOfWork.issueSQLbeforeCompletion(Unknown
Source)
at oracle.toplink.jts.AbstractSynchronizationListener.beforeCompletion(Unknown
Source)
at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:551)
at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:88)
at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:982)
at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:1506)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:215)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:189)
at weblogic.transaction.internal.TransactionManagerImpl.commit(TransactionManagerImpl.java:247)
at com.pws.ubiquity.pr.business.TransactionTypeFacade.addTransactionType(TransactionTypeFacade.java:584)
at com.pws.ubiquity.pr.business.TransactionTypeFacade_ocr0a6_EOImpl.addTransactionType(TransactionTypeFacade_ocr0a6_EOImpl.java:271)
at com.pws.ubiquity.pr.web.action.AddTransactionTypeAction.doExecute(AddTransactionTypeAction.java:120)
at com.pws.ubiquity.common.web.action.SecureAction.perform(SecureAction.java:240)
at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1786)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
INTERNAL EXCEPTION STACK:
java.sql.SQLException: ORA-00904: invalid column name
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:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at weblogic.jdbc.jts.Statement.executeUpdate(Statement.java:503)
at weblogic.jdbc.rmi.internal.PreparedStatementImpl.executeUpdate(PreparedStatementImpl.java:66)
at weblogic.jdbc.rmi.SerialPreparedStatement.executeUpdate(SerialPreparedStatement.java:57)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(Unknown
Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeNoSelect(Unknown
Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(Unknown
Source)
at oracle.toplink.publicinterface.UnitOfWork.executeCall(Unknown Source)
at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown
Source)
at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown
Source)
at oracle.toplink.internal.queryframework.CallQueryMechanism.insertObject(Unknown
Source)
at oracle.toplink.internal.queryframework.StatementQueryMechanism.insertObject(Unknown
Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(Unknown
Source)
at oracle.toplink.queryframework.InsertObjectQuery.executeCommit(Unknown Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.performUserDefinedWrite(Unknown
Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.performUserDefinedInsert(Unknown
Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(Unknown
Source)
at oracle.toplink.queryframework.WriteObjectQuery.executeCommit(Unknown Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.executeWrite(Unknown
Source)
at oracle.toplink.queryframework.WriteObjectQuery.execute(Unknown Source)
at oracle.toplink.queryframework.DatabaseQuery.execute(Unknown Source)
at oracle.toplink.publicinterface.Session.internalExecuteQuery(Unknown Source)
at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(Unknown Source)
at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
at oracle.toplink.internal.sessions.CommitManager.commitAllObjects(Unknown Source)
at oracle.toplink.publicinterface.Session.writeAllObjects(Unknown Source)
at oracle.toplink.publicinterface.UnitOfWork.commitToDatabase(Unknown Source)
at oracle.toplink.publicinterface.UnitOfWork.issueSQLbeforeCompletion(Unknown
Source)
at oracle.toplink.jts.AbstractSynchronizationListener.beforeCompletion(Unknown
Source)
at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:551)
at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:88)
at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:982)
at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:1506)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:215)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:189)
at weblogic.transaction.internal.TransactionManagerImpl.commit(TransactionManagerImpl.java:247)
at com.pws.ubiquity.pr.business.TransactionTypeFacade.addTransactionType(TransactionTypeFacade.java:584)
at com.pws.ubiquity.pr.business.TransactionTypeFacade_ocr0a6_EOImpl.addTransactionType(TransactionTypeFacade_ocr0a6_EOImpl.java:271)
at com.pws.ubiquity.pr.web.action.AddTransactionTypeAction.doExecute(AddTransactionTypeAction.java:120)
at com.pws.ubiquity.common.web.action.SecureAction.perform(SecureAction.java:240)
at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1786)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
--------------- nested within: ------------------
weblogic.transaction.RollbackException: Unexpected exception in beforeCompletion:
sync=oracle.toplink.jts.wls.WebLogicSynchronizationListener@373d4a
EXCEPTION DESCRIPTION: java.sql.SQLException: ORA-00904: invalid column name
INTERNAL EXCEPTION: java.sql.SQLException: ORA-00904: invalid column name
ERROR CODE: 904 - with nested exception:
[EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.DatabaseException
EXCEPTION DESCRIPTION: java.sql.SQLException: ORA-00904: invalid column name
INTERNAL EXCEPTION: java.sql.SQLException: ORA-00904: invalid column name
ERROR CODE: 904]
at weblogic.transaction.internal.TransactionImpl.throwRollbackException(TransactionImpl.java:1490)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:265)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:189)
at weblogic.transaction.internal.TransactionManagerImpl.commit(TransactionManagerImpl.java:247)
at com.pws.ubiquity.pr.business.TransactionTypeFacade.addTransactionType(TransactionTypeFacade.java:584)
at com.pws.ubiquity.pr.business.TransactionTypeFacade_ocr0a6_EOImpl.addTransactionType(TransactionTypeFacade_ocr0a6_EOImpl.java:271)
at com.pws.ubiquity.pr.web.action.AddTransactionTypeAction.doExecute(AddTransactionTypeAction.java:120)
at com.pws.ubiquity.common.web.action.SecureAction.perform(SecureAction.java:240)
at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1786)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
2002-11-27 11:56:25,793 DEBUG com.pws.framework.common.MessageSourceFactory -
Get MessageSource for error message.:
2002-11-27 11:56:25,793 DEBUG com.pws.framework.common.MessageSourceFactory -
Get MessageSource for error message.:
com.pws.framework.exception.GeneralException: There was an unexpected error. Please
contact your system administrator.
at com.pws.framework.exception.GeneralException.create(GeneralException.java:111)
at com.pws.ubiquity.pr.business.TransactionTypeFacade.addTransactionType(TransactionTypeFacade.java:588)
at com.pws.ubiquity.pr.business.TransactionTypeFacade_ocr0a6_EOImpl.addTransactionType(TransactionTypeFacade_ocr0a6_EOImpl.java:271)
at com.pws.ubiquity.pr.web.action.AddTransactionTypeAction.doExecute(AddTransactionTypeAction.java:120)
at com.pws.ubiquity.common.web.action.SecureAction.perform(SecureAction.java:240)
at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1786)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)We have changed default thin driver to 920 from 817 in 610sp4. If you are using 817/901 dbserver, please put 817/901 classes12.zip in your
classpath before weblogic.jar and you will be ok.
Mitesh
vivek wrote:
We have been using WLS 6.1 sp2 with toplink and never had any problems. Recently
we migrated to sp4 and get a invalid column name exception while updating records.
For select queries there is no error. The SQL generated by toplink is -
UPDATE PR_SUPP SET CNTC_PRSN_NAME = ''
, REMK = 'Remark 123', LAST_CHNG_DTTM = {ts '2002-11-29 10:59:56.0'} WHERE ((S
UPP_CODE = 'A0001') AND (LAST_CHNG_DTTM = {ts '2002-11-29 10:46:01.0'}))
It looks like some problem with the JDBC driver. The databse is Oracle 8.17. How
to fix it
The exception stack trace is -
2002-11-27 11:56:25,763 ERROR com.pws.ubiquity.pr.business.TransactionTypeFacade
- Error while commiting transaction (creating TransactionType):LOCAL EXCEPTION
STACK:
EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.DatabaseException
EXCEPTION DESCRIPTION: java.sql.SQLException: ORA-00904: invalid column name
INTERNAL EXCEPTION: java.sql.SQLException: ORA-00904: invalid column name
ERROR CODE: 904
at oracle.toplink.exceptions.DatabaseException.sqlException(Unknown Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(Unknown
Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeNoSelect(Unknown
Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(Unknown
Source)
at oracle.toplink.publicinterface.UnitOfWork.executeCall(Unknown Source)
at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown
Source)
at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown
Source)
at oracle.toplink.internal.queryframework.CallQueryMechanism.insertObject(Unknown
Source)
at oracle.toplink.internal.queryframework.StatementQueryMechanism.insertObject(Unknown
Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(Unknown
Source)
at oracle.toplink.queryframework.InsertObjectQuery.executeCommit(Unknown Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.performUserDefinedWrite(Unknown
Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.performUserDefinedInsert(Unknown
Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(Unknown
Source)
at oracle.toplink.queryframework.WriteObjectQuery.executeCommit(Unknown Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.executeWrite(Unknown
Source)
at oracle.toplink.queryframework.WriteObjectQuery.execute(Unknown Source)
at oracle.toplink.queryframework.DatabaseQuery.execute(Unknown Source)
at oracle.toplink.publicinterface.Session.internalExecuteQuery(Unknown Source)
at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(Unknown Source)
at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
at oracle.toplink.internal.sessions.CommitManager.commitAllObjects(Unknown Source)
at oracle.toplink.publicinterface.Session.writeAllObjects(Unknown Source)
at oracle.toplink.publicinterface.UnitOfWork.commitToDatabase(Unknown Source)
at oracle.toplink.publicinterface.UnitOfWork.issueSQLbeforeCompletion(Unknown
Source)
at oracle.toplink.jts.AbstractSynchronizationListener.beforeCompletion(Unknown
Source)
at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:551)
at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:88)
at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:982)
at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:1506)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:215)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:189)
at weblogic.transaction.internal.TransactionManagerImpl.commit(TransactionManagerImpl.java:247)
at com.pws.ubiquity.pr.business.TransactionTypeFacade.addTransactionType(TransactionTypeFacade.java:584)
at com.pws.ubiquity.pr.business.TransactionTypeFacade_ocr0a6_EOImpl.addTransactionType(TransactionTypeFacade_ocr0a6_EOImpl.java:271)
at com.pws.ubiquity.pr.web.action.AddTransactionTypeAction.doExecute(AddTransactionTypeAction.java:120)
at com.pws.ubiquity.common.web.action.SecureAction.perform(SecureAction.java:240)
at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1786)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
INTERNAL EXCEPTION STACK:
java.sql.SQLException: ORA-00904: invalid column name
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:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at weblogic.jdbc.jts.Statement.executeUpdate(Statement.java:503)
at weblogic.jdbc.rmi.internal.PreparedStatementImpl.executeUpdate(PreparedStatementImpl.java:66)
at weblogic.jdbc.rmi.SerialPreparedStatement.executeUpdate(SerialPreparedStatement.java:57)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(Unknown
Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeNoSelect(Unknown
Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(Unknown
Source)
at oracle.toplink.publicinterface.UnitOfWork.executeCall(Unknown Source)
at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown
Source)
at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown
Source)
at oracle.toplink.internal.queryframework.CallQueryMechanism.insertObject(Unknown
Source)
at oracle.toplink.internal.queryframework.StatementQueryMechanism.insertObject(Unknown
Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(Unknown
Source)
at oracle.toplink.queryframework.InsertObjectQuery.executeCommit(Unknown Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.performUserDefinedWrite(Unknown
Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.performUserDefinedInsert(Unknown
Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(Unknown
Source)
at oracle.toplink.queryframework.WriteObjectQuery.executeCommit(Unknown Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.executeWrite(Unknown
Source)
at oracle.toplink.queryframework.WriteObjectQuery.execute(Unknown Source)
at oracle.toplink.queryframework.DatabaseQuery.execute(Unknown Source)
at oracle.toplink.publicinterface.Session.internalExecuteQuery(Unknown Source)
at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(Unknown Source)
at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
at oracle.toplink.internal.sessions.CommitManager.commitAllObjects(Unknown Source)
at oracle.toplink.publicinterface.Session.writeAllObjects(Unknown Source)
at oracle.toplink.publicinterface.UnitOfWork.commitToDatabase(Unknown Source)
at oracle.toplink.publicinterface.UnitOfWork.issueSQLbeforeCompletion(Unknown
Source)
at oracle.toplink.jts.AbstractSynchronizationListener.beforeCompletion(Unknown
Source)
at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:551)
at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:88)
at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:982)
at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:1506)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:215)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:189)
at weblogic.transaction.internal.TransactionManagerImpl.commit(TransactionManagerImpl.java:247)
at com.pws.ubiquity.pr.business.TransactionTypeFacade.addTransactionType(TransactionTypeFacade.java:584)
at com.pws.ubiquity.pr.business.TransactionTypeFacade_ocr0a6_EOImpl.addTransactionType(TransactionTypeFacade_ocr0a6_EOImpl.java:271)
at com.pws.ubiquity.pr.web.action.AddTransactionTypeAction.doExecute(AddTransactionTypeAction.java:120)
at com.pws.ubiquity.common.web.action.SecureAction.perform(SecureAction.java:240)
at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1786)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
--------------- nested within: ------------------
weblogic.transaction.RollbackException: Unexpected exception in beforeCompletion:
sync=oracle.toplink.jts.wls.WebLogicSynchronizationListener@373d4a
EXCEPTION DESCRIPTION: java.sql.SQLException: ORA-00904: invalid column name
INTERNAL EXCEPTION: java.sql.SQLException: ORA-00904: invalid column name
ERROR CODE: 904 - with nested exception:
[EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.DatabaseException
EXCEPTION DESCRIPTION: java.sql.SQLException: ORA-00904: invalid column name
INTERNAL EXCEPTION: java.sql.SQLException: ORA-00904: invalid column name
ERROR CODE: 904]
at weblogic.transaction.internal.TransactionImpl.throwRollbackException(TransactionImpl.java:1490)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:265)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:189)
at weblogic.transaction.internal.TransactionManagerImpl.commit(TransactionManagerImpl.java:247)
at com.pws.ubiquity.pr.business.TransactionTypeFacade.addTransactionType(TransactionTypeFacade.java:584)
at com.pws.ubiquity.pr.business.TransactionTypeFacade_ocr0a6_EOImpl.addTransactionType(TransactionTypeFacade_ocr0a6_EOImpl.java:271)
at com.pws.ubiquity.pr.web.action.AddTransactionTypeAction.doExecute(AddTransactionTypeAction.java:120)
at com.pws.ubiquity.common.web.action.SecureAction.perform(SecureAction.java:240)
at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1786)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
2002-11-27 11:56:25,793 DEBUG com.pws.framework.common.MessageSourceFactory -
Get MessageSource for error message.:
2002-11-27 11:56:25,793 DEBUG com.pws.framework.common.MessageSourceFactory -
Get MessageSource for error message.:
com.pws.framework.exception.GeneralException: There was an unexpected error. Please
contact your system administrator.
at com.pws.framework.exception.GeneralException.create(GeneralException.java:111)
at com.pws.ubiquity.pr.business.TransactionTypeFacade.addTransactionType(TransactionTypeFacade.java:588)
at com.pws.ubiquity.pr.business.TransactionTypeFacade_ocr0a6_EOImpl.addTransactionType(TransactionTypeFacade_ocr0a6_EOImpl.java:271)
at com.pws.ubiquity.pr.web.action.AddTransactionTypeAction.doExecute(AddTransactionTypeAction.java:120)
at com.pws.ubiquity.common.web.action.SecureAction.perform(SecureAction.java:240)
at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1786)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) -
Invalid column name in query string - using Format function
In my post just before this one the problem was solved for writing a query string using a date range. The rest of the query string includes the same date field (Call_Date) but formatted as 'MMM-YY'. I get an invalid column name error when I add this field to the query string. Here is the rest of the query string:
strSql = "SELECT Format(CALL_DATE,'mmm-yy'), " _
& "HOME_REGION FROM CCC2.CASE_EPRP " _
& "WHERE (HOME_REGION = 'NCR') AND " _
"(CALL_DATE >= to_date( '1/1/2002', 'MM/DD/YYYY' )" _
& "AND CALL_DATE <= to_date( '2/28/2003', 'MM/DD/YYYY' ))"
In the Access Query tool I can include this field
Format(CALL_DATE,'mmm-yy')
and the query runs fine (I just need to make it dynamic using ADO). But in my ADO query string above, I get the invalid column name error. Is there a way I can include
Format(CALL_DATE,'mmm-yy')
in my ADO query string? I appologize for not being more familiar with Oracle Sql. Any help greatly appreciated.
Thanks again,
RichThank you very much for your reply. I think I'm getting closer to the solution. Just I got an error message
"date format not recognized"
when I add "to_char( call_date, 'mmm-yy' )" to the query string. I tried using all uppercase, but that did not make a difference. Do I need to use to_date inside the to_char maybe?
to_char(to_date(call_date, 'mmm/yy'), 'mmm-yy')
Thanks again for your help.
Rich -
Use of NOT IN leads to an invalid column name error
The query works just fine when placed directly into sql plus
The query works, called from a Java using an Oracle Statement, ONLY IF I remove the NOT.
However, with NOT it chokes, and gives me this:
selQ=select lenum, zeugn from stock_rpt where lenum NOT in ('X12345', 'X23456')
Could Select or Read Selected data
java.sql.SQLException: Invalid column name
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:3319)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1926)
at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1515)
at ecspack.StockRpt.selRecsByQ(StockRpt.java:172)
at ecspack.StockRpt.selByDiff(StockRpt.java:261)
at teste.main(teste.java:40)
The column does have an index.
The above is my simplified test query, I am using to narrow down the problem.
SelQ is the value of the Select String.
Really I want to do something like this:
select x1, x2 from tableX where x1 NOT IN (select y1 from tableY)
I know I can just compare records one at a time, but I would rather not, if there is a way to make NOT IN work.
Thank youHi Eileen Keeney ,
may be you can use prepared statement but beware of sql injection
selQ=select lenum, zeugn from stock_rpt where lenum NOT in ('X12345', 'X23456')
Try :
selQ=select lenum, zeugn from stock_rpt where lenum NOT in (?, ?)
Then try running it with this fixed parameter binding:
prest.setString(1, "X12345");
prest.setString(2, "X23456"); -
when i run the following query i getbthe error invalid column name .My db oracle 8i,NT.
rs8 = stmt2.executeQuery("select a.c_x12n_position_cd, a.c_x12n_sequence_cd, a.c_x12n_composite_id, " +
"a.c_x12n_table_area_cd, a.c_x12n_requirement_cd, a.c_x12n_reference_designator, " +
"a.c_x12n_loop_level_nb, b.c_dg_type_code, b.c_dg_usage_cd, b.c_dg_max_occurrences_nb, " +
"b.c_dg_min_occurrences_nb from T_x12n_supplement a, T_Data_Group_Format b, " +
"T_Message_Node_Directory c " +
"where (a.c_dgc_ik = c.c_dgc_ik) " +
"and (a.c_dgc_ik = b.c_dgc_ik) " +
"and (a.c_dg_ik = c.c_dg_ik) " +
"and (a.c_dg_ik = b.c_dg_ik)");Run the query in SQL*Plus. It will give you more information about which column it doesn't like.
-
Invalid column name error in JDBC adapter
Hi all,
My scenario is Proxy->XI->JDBC.
I get the following error in receiver JDBC adapter.
Unable to execute statement for table or stored procedure. 'Account_Master' (Structure 'STATEMENT') due to com.microsoft.sqlserver.jdbc.SQLServerException: Invalid column name 'A7'.
There is no column by name A7 in the table nor there is a field by that name in the data type.
Can anyone provide any helpHi Swatantra,
compare your message-type with the database table!
There must be difference!
Regards Mario -
After 8.8 Upgrade Invalid Column Name error on UDF in Sales Order
I have upgraded a dtaabase from 2005A to 8.8 SP00 PL15.
I encountered a UDF/UDT warning (Note 1360832) in the Pre-Upgrade CHeck but proceeded in any case.
After the upgrade as soon as I enter the BP in a Sales Order, I get the following error.
[Microsoft] [SQL Server Native Client 10.0] [SQL Server] [Invalid Column Name U_CampPB1.2)
[Microsoft] [SQL Server Native Client 10.0] [SQL Server] Statement 'Withholding Tax' (OWHT) could not be prepared.
This UDF was one of many reported in the Upgrade Wizard Log File as having an incorrect Type.
" Type is different; Should be A, Is M".
There are hundreds of instances of this message in the log.
I don't know whether the error is related to the Type is different warning.
I don't get the error when I add an AR Invoice.
In addition I cannot find any documentation on the different UDF Type codes.Hi,
should you have any errors before or after upgrade, log a message to a support. That's the best solution.
JimM -
SSMS 2012: Using CTE in a query - Invalid column name 'EmployeeID' !!??
Hi all,
From Page 88 of the Book "SQL Programming & Database Design Using Microsoft SQL Server 2012" written by Kalman Toth, I copied the following code of Using CTE in a query:
-- CTETest2.sql /// saved in C:\My Documents\SQL Server Management Studio\
----Page 88 of Book by Toth === Using CTE in a query ----- 13 March 2015
--Using CTE in a query
;WITH CTE (SalesPersonID, NumberOfOrders, MostRecentOrderDate)
AS (SELECT SalesPersonID, COUNT(*), CONVERT(date, MAX(OrderDate))
FROM Sales.SalesOrderHeader GROUP BY SalesPersonID )
--Start of outer (main) query
SELECT E.EmployeeID,
OE.NumberOfOrders AS EmpOrders,
OE.MostRecentOrderDate AS EmpLastOrder,
E.ManagerID,
OM.NumberOfOrders AS MgrOrders,
OM.MostRecentOrderDate AS MgrLastOrder
FROM HumanResources.Employee AS E
INNER JOIN CTE AS OE ON E.EmployeeID = OE.SalesPersonID
LEFT OUTER JOIN CTE AS OM ON E.ManagerID = OM.SalesPersonID
In my SQL Server 2012 Management Studio, I executed this set of code and I got the following fatal error:
Msg 207, Level 16, State 1, Line 16
Invalid column name 'EmployeeID'.
I have no clues why I got this error message in this .sql trial of my second practice in doing CTE. Please kindly help and let me know where I made mistake and how to resolve this problem.
Thanks in advance,
Scott ChangHi scott_morris-ga, Thanks for your nice response.
I changed EmployeeID to BusinessEntityID as you pointed out and executed the revised code:
-- CTETest2.sql /// saved in C:\My Documents\SQL Server Management Studio\
----Page 88 of Book by Toth === Using CTE in a query ----- 13 March 2015
--Using CTE in a query
;WITH CTE (SalesPersonID, NumberOfOrders, MostRecentOrderDate)
AS (SELECT SalesPersonID, COUNT(*), CONVERT(date, MAX(OrderDate))
FROM Sales.SalesOrderHeader GROUP BY SalesPersonID )
--Start of outer (main) query
SELECT E.BusinessEntityID,
OE.NumberOfOrders AS EmpOrders,
OE.MostRecentOrderDate AS EmpLastOrder,
E.ManagerID,
OM.NumberOfOrders AS MgrOrders,
OM.MostRecentOrderDate AS MgrLastOrder
FROM HumanResources.Employee AS E
INNER JOIN CTE AS OE ON E.BusinessEntityID = OE.SalesPersonID
LEFT OUTER JOIN CTE AS OM ON E.ManagerID = OM.SalesPersonID
I got 2 new error messages:
Msg 207, Level 16, State 1, Line 17
Invalid column name 'ManagerID'.
Msg 207, Level 16, State 1, Line 12
Invalid column name 'ManagerID'.
I have no ideas what should be used to replace 'ManagerID' in my revised code. Could you please help again and give me the right thing to replace the 'ManagerID'? By the way, where in the AdventureWorks do you find the right things? Please enlighten
me in this matter.
Many Thanks again, Scott Chang -
Using oracle thin driver with to_char gives invalid column name
select x,y,z, to_char(event_time,'YYYY-MMM-DD') from eventtable;
if i execute the above query using oracle thin driver it gives me invalid column name. It works fine if i use weblogic driver. So what could be the problem ???
thanks.Sorry , forgot to add that 'YYYY-MM-DD' or 'YYYY-Month-DD' or 'Year-MM-DD' or 'Year-Month-DD' are also allowed(please cheek also for other combinations), not 'YYYY-MMM-DD'.
Thanks -
Using "$" character with Oracle; getting "invalid column name"
I am running the following query against an Oracle database:
select price from my_table
where index_name = 'CGPR_C$'
and settlement_date = to_date('02/19/2001','MM/DD/YYYY')
The query runs fine in TOAD.
If I run this query from my java code, I get an "invalid column name" exception.
If I take out the "$" character, the query runs fine.
I've tried inserting the "$" in as unicode, escaping out the character, ||chr(36)||, and nothing works.
Please help!
AshleyLook up your Oracle SQL documentation and find out how to use column names that would otherwise be invalid. Some databases allow you to put column names, table names, and so on in square brackets (e.g. [CGPR_C$]) but I don't know Oracle's syntax.
-
Having an interesting problem with a site I'm fixing. I'm
sure I'm looking past the obvious, so maybe some of you can help:
ASP Pages display results from recordset based on a session
variable (memberID) that is created during user login.
Recordset looks like this:
<%
Dim rs__MMColParam
rs__MMColParam = "%"
If (Session("memberID") <> "") Then
rs__MMColParam = Session("memberID")
End If
%>
<%
set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_cnConnection_STRING
rs.Source = "SELECT id, adminusername, anotherone1,
anotherone2, anotherone3 FROM dbo.basic1 WHERE adminusername = '" +
Replace(rs__MMColParam, "'", "''") + "'"
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 3
rs.Open()
rs_numRows = 0
%>
Seems correct to me, unles I'm overlooking something obvious.
Unfortunately I keep getting the following error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column
name 'SESSIONVAR'.
(Note: in this error above, SESSIONVAR is the name of the
session variable memberID)
Strange thing is, as long as the session variable is a #,
everything works. If it's a word, it won't work. So it appears the
session variables are being defined and passed to the next page.
As for the database, it's a SQL Database
column 'adminusername' is a NVARCHAR with a 4000 char limit
Thanks in advance for any help.Are you sure the query is the same? It looks like the one you posted has a syntax error
SELECT e.emp_id, e.dep_id
FROM emp e, loc ct, dep dt
WHERE[b] c.dep_id[/b] IN (SELECT dt.dep_idYou've aliased the LOC table to CT in the FROM clause, but you're using the alias C in the WHERE clause. You use the correct alias CT in the query in your IN clause.
Justin
Maybe you are looking for
-
Error while activating a screen copied from another program ??
Friends, i have a requirement wherin a screen should come as a popup when a button in the selection screen is clicked. The same screen which needs to be displayed, is also present in another program. So i copied the screen and the appropriate fields
-
Connection Lyinksys srw with IOS 1.0.2 with Rancid
Hi all!! I want to modify an already existing script that was used to connect to a Linksys switch 1.0.4. or the switch I have are version 1.0.2 and it is impossible to put to update. Here is the script version 1.0.4 is the csblogin here The differenc
-
Urgent ! problem with ADT or OCI mode
Hi to all I'm working with Oracle developer 9i. Developing a report I tried to compile a trigger (in section 'before report') in which I declare an array that is a type returned by a function pl/sql that is into a package on server oracle 8.1.7. I ca
-
Time machine cannot make a backup
I use Mountain Lion 10.8.4. Recently my Time Machine started to behave wierdly: when backup is going, expected backup size is always by few GB larger than completed part. So that at one point of time it's 70 of 74 GB's done, after that it's 71 of 75
-
Hello Everyone, I found useful info here regarding company structure and cross company sales. I just like to confirm the following understanding is correct: 1. Cross company sales: The Delivering Plant can be assigned to Sales Org1 which is assigned