Query on AWR tables to get a statistic on access to a table

Hi all,
I'm trying to find a way, querying awr tables, to find how many times per hour (as any snapshot is hourly) a table SCOTT.EMP is accessed or an application called myapp.exe perform SELECT operation on a schema...
Does anyone already have a query for this?
Thanks
Luke

Hi,
Check the below can help you :
http://www.oracleexpert.co.uk/2008/12/useful-10g-awr-historical-system-views/
Best regards,
Rafi.
http://rafioracledba.blogspot.com/

Similar Messages

  • I have a column where I have implemented writeback, its working fine. On top of this I need to show 0 as No and 1 as yes in our report, that is also done. Now I want to enter Yes in a column where it was no and I want database table to get update with 1.

    I have a column where I have implemented writeback, its working fine. On top of this I need to show 0 as No and 1 as yes in our report, that is also done. Now I want to enter Yes in a column where it was no and I want database table to get update with 1. I am not sure how to do it. SOmeone please help me out.

    Hi ,
    In your write back XML  try the below  query insert
    INSERT INTO TABLE_XYZ (attribute1)  values (SELECT CASE  WHEN @{C1}=’Yes’ then 1 when @{C1}=’No’ then 0 else null end from dual)
    Regards
    Rajagopal

  • MSSQL Query/View Single Line Output For Combined Multiple Data Elements - Possible Pivot Table?

    HELLO...
    I hope you experts out there can help me.  Consider the following (2) Tables in MSSQL:
    1. TENDERED --> Primary Key = DATE / DOC_NO / PAYMENT_SEQ_NO
    DATE
    DOC_NO
    PMNT_SEQ_NO
    PAYCODE_TYPE
    AMOUNT
    2. TENDERED_CR_CARD -->Primary Key = DATE / DOC_NO / PAYMENT_SEQ_NO
    DATE
    DOC_NO
    PMNT_SEQ_NO
    CR_CARD_NO_MASKED
    CR_CARD_NAME
    CR_CARD_EXP_DATE
    These two tables are certainly related, based on their Primary Key values.
    Now, consider the following data in those two tables:
    DATE            
    DOC_NO      PMNT_SEQ_NO              
    PAYCODE_TYPE               
    AMOUNT
    03/10/2014         100001 
    1             
    CASH            
    100.00
    03/10/2014         100001 
    2             
    CASH                             
    -9.75
    03/10/2014         100002 
    1             
    CASH                             
    50.00
    03/10/2014         100002 
    2             
    VISA                             
    100.00
    03/10/2014         100002 
    3             
    VISA             
                   250.00
    03/10/2014         100003 
    1             
                            MC
    125.00
    03/10/2014         100003 
    2             
    AMEX           
    75.00
    DATE          
    DOC_NO PMNT_SEQ_NO  CR_CARD_MASKED     
    NAME            
    CR_CARD_EXP
    03/10/2014  100002   2                       4225******801289  
    MARY JONES   2016/08/31
    03/10/2014  100002   3                       4121******637442  
    JOHN DOE      2015/04/30
    03/10/2014  100003   1                       5428******971134  
    MIKE BAKER   2018/09/30
    03/10/2014  100003   2                       3732*****344756    
    LINDA LIU      2017/07/31
    OK...so what we NEED...is a Combined, SINGLE RECORD Audit Report type query. 
    The resulting query should show, based on the Data from above, the SINGLE LINE represented in the Attached Spreadsheet. 
    NOTE...what's important to point out here..is that ONLY the 'CASH' Tender gets "summed"...EACH INDIVIDUAL Credit Card record MUST have its own Field...as represented in the corresponding Columns of the Spreadsheet (i.e. PMT_TYP_1, AMT_1, PMT_TYP_2,
    AMT_2, and so forth).
    PLEASE HELP!  Any suggestions/advice would be most appreciated! 
    Thank You!...Mark

    I would not do this in SQL if I could possibly avoid it.  Instead do it in the front end.
    If you must do it in SQL, this is a dynamic pivot on multiple columns.  Naomi Nosonovsky has a blog at
    http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/dynamic-pivot-on-multiple-columns/ on how to do that.  Look especially at her second example using the claims table.  Of course, you must do some manipulation even before you do the multi-column
    pivot, since you must first combine all the cash entries.
    So one way to do it would be to build a temp table with all the entries you have except the cash entries combined into one payment sequence number.  To do that you may need specifications that are not clear to me from what you have given us.  For
    example, if PMT SEQ 1 is VISA,  PMT SEQ 2 is CASH, PMT SEQ 3 is VISA, PMT SEQ 4 is CASH, and PMT SEQ 5 is VISA, you want to combine the two cash payments.  So they become PMT SEQ 2?  If so, what happens to PMT SEQ 4 - is it left N/A or does
    PMT SEQ 5 become PMT SEQ 4?
    But once you have this temp table with the cash payments combined in the algorithm you need, then you can use Naomi's method to do the multi-column pivot.  Note that Naomi uses the code
    FROM INFORMATION_SCHEMA.COLUMNS
    WHERE TABLE_Name = 'Claims'
    to get the column names from the permanent table Claims.  To get the column names from a temp table use code like the following.  To find the column names in a temp table named #MyTempTable, do
    From tempdb.sys.columns
    Where object_id = OBJECT_ID('#MyTempTable')
    But as I say, if feasible, I would do this in the front end, not in SQL.  T-SQL is a very good language for storing and retrieving data, not so good at formatting it. 
    Tom

  • Master table, detail table, detail table not getting refreshed selection

    i have a page where i am displaying data as master table and detail table. both table VOs are based on SQL queries which use bind variables.
    i have a view link between vos of type 1:M
    i created master table detail table page by dropping detail iterator from data control panel under master and selecting master table detail table
    on my page i see detail table records getting populated only for first record of parent table.
    on changing parent record, child table shows same records and does not refresh
    i am using partial triggers on both tables to be populated on a button click as i need to pass some bind variables to VOs which are taken as input from users
    how can i show corresponding rows in detail table when parent record in table changes
    will i have to use table selection listener
    is it possible declaratively to have master detail table view when both VOs have bind variables
    jdev 11 1 1 5

    these are the SQLs used
    Parent SQL Based VO Query
    SELECT to_char(d.status_date,'yyyymmddhh24') TIME123, count(DISTINCT d.c4)
    FROM t1 d,
    t2 w
    WHERE w.c1 = nvl(:ou, w.c1)
    AND UPPER(w.c2) = UPPER(nvl(:tt, w.c2))
    AND d.c3 >= :startTime AND :startTime IS NOT NULL
    AND d.c3 <= :endTime AND :endTime IS NOT NULL
    AND d.c4 = w.c4
    AND UPPER(d.status) = 'CLOSED'
    GROUP BY to_char(status_date,'yyyymmddhh24') ORDER BY to_char(status_date,'yyyymmddhh24') DESC
    Child SQL Based VO Query
    SELECT w.c1,
    w.c5 - w.c6 processing_time,
    w.c3,
    w.c6,
    w.c7,
    w.c8,
    to_char(d.status_date,'yyyymmddhh24') TIME123 FROM t1 d,
    t2 w
    WHERE w.c2 = nvl(:ou, w.c2)
    AND UPPER(w.c3) = UPPER(nvl(:tt, w.c3))
    AND d.c4 >= :startTime AND :startTime IS NOT NULL
    AND d.c4 <= :endTime AND :endTime IS NOT NULL
    AND d.c1 = w.c1
    AND UPPER(d.status) = 'CLOSED' ORDER BY to_char(status_date,'yyyymmddhh24') DESC
    view link is based on column TIME123

  • How to fetch the data from databse table and get the required output

    Hi,
    I have made a project that connects CEP to database table but i m getting some problem in fetching the data from database.
    From the following code :
    If the where condition is removed then the application runs fine but i am still not able to fetch the data from the table because it is not showing any output.
    Can anyone please suggest me that how to write WHERE statement correctly and how i will be able to see the output.
    Following is the config.xml for processor:
    ======================================
    <?xml version="1.0" encoding="UTF-8"?>
    <wlevs:config xmlns:wlevs="http://www.bea.com/ns/wlevs/config/application"
         xmlns:jdbc="http://www.oracle.com/ns/ocep/config/jdbc">
         <processor>
              <name>JDBC_Processor</name>
              <rules>
                   <query id="q1"><![CDATA[
                             SELECT STOCK.SYMBOL as symbol, STOCK.EXCHANGE as exchange
                             FROM ExchangeStream [Now] as datastream, STOCK
                             WHERE datastream.SYMBOL = datastream.SYMBOL ]]></query>
              </rules>
         </processor>
         <jms-adapter>
              <name>JMS_IN_Adapter</name>
              <jndi-provider-url>t3://CHDSEZ135400D:7001</jndi-provider-url>
              <destination-jndi-name>jms.TestKanikaQueue</destination-jndi-name>
              <user>weblogic</user>
              <password>welcome1</password>
         </jms-adapter>
    </wlevs:config>
    Following is the assembly file:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
         xmlns:wlevs="http://www.bea.com/ns/wlevs/spring" xmlns:jdbc="http://www.oracle.com/ns/ocep/jdbc"
         xmlns:spatial="http://www.oracle.com/ns/ocep/spatial"
         xsi:schemaLocation="
              http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/osgi
              http://www.springframework.org/schema/osgi/spring-osgi.xsd
              http://www.bea.com/ns/wlevs/spring
              http://www.bea.com/ns/wlevs/spring/spring-wlevs-v11_1_1_3.xsd
              http://www.oracle.com/ns/ocep/jdbc
              http://www.oracle.com/ns/ocep/jdbc/ocep-jdbc.xsd
              http://www.oracle.com/ns/ocep/spatial
              http://www.oracle.com/ns/ocep/spatial/ocep-spatial.xsd">
         <wlevs:event-type-repository>
              <wlevs:event-type type-name="StockEvent">
                   <wlevs:properties>
                        <wlevs:property name="SYMBOL" type="byte[]" length="16" />
                        <wlevs:property name="EXCHANGE" type="byte[]" length="16" />
                   </wlevs:properties>
              </wlevs:event-type>
              <wlevs:event-type type-name="ExchangeEvent">
                   <wlevs:class>com.bea.wlevs.event.example.JDBC_CEP.ExchangeEvent</wlevs:class>
              </wlevs:event-type>
              <wlevs:event-type type-name="StockExchangeEvent">
                   <wlevs:properties>
                        <wlevs:property name="symbol" type="byte[]" length="16" />
                        <wlevs:property name="price" type="byte[]" length="16" />
                        <wlevs:property name="exchange" type="byte[]" length="16" />
                   </wlevs:properties>
              </wlevs:event-type>
         </wlevs:event-type-repository>
         <bean id="readConverter" class="com.bea.wlevs.adapter.example.JDBC_CEP.Adapter_JDBC" />
         <bean id="outputJDBCBean" class="com.bea.wlevs.bean.example.JDBC_CEP.OutputBean_JDBC">
         </bean>
         <wlevs:adapter id="JMS_IN_Adapter" provider="jms-inbound">
              <wlevs:listener ref="ExchangeStream" />
              <wlevs:instance-property name="converterBean"
                   ref="readConverter" />
         </wlevs:adapter>
         <wlevs:processor id="JDBC_Processor" advertise="true">
              <wlevs:listener ref="OutputChannel" />
              <wlevs:table-source ref="STOCK" />
         </wlevs:processor>
         <wlevs:channel id="ExchangeStream" event-type="ExchangeEvent" advertise="true">
              <wlevs:listener ref="JDBC_Processor" />
         </wlevs:channel>
         <wlevs:channel id="OutputChannel" event-type="StockExchangeEvent"
              advertise="true">
              <wlevs:listener ref="outputJDBCBean" />
         </wlevs:channel>
         <wlevs:table id="STOCK" event-type="StockEvent"
              data-source="StockDs" table-name="STOCK" />
         <wlevs:table id="STOCK_EXCHANGE" event-type="StockExchangeEvent"
              data-source="StockDs" table-name="STOCK_EXCHANGE" />
    </beans>
    ExchangeEvent.java:
    package com.bea.wlevs.event.example.JDBC_CEP;
    public class ExchangeEvent {
         public String SYMBOL;
         public String symbol;
         public String exchange;
         public ExchangeEvent() {
         public String getSYMBOL() {
              return SYMBOL;
         public void setSYMBOL(String sYMBOL) {
              SYMBOL = sYMBOL;
         public String getSymbol() {
              return symbol;
         public void setSymbol(String symbol) {
              this.symbol = symbol;
         public String getExchange() {
              return exchange;
         public void setExchange(String price) {
              this.exchange = price;
    Adapter Class:
    package com.bea.wlevs.adapter.example.JDBC_CEP;
    import com.bea.wlevs.adapter.example.JDBC_CEP.MyLogger;
    import com.bea.wlevs.adapters.jms.api.InboundMessageConverter;
    import java.text.DateFormat;
    import java.util.Date;
    import com.bea.wlevs.adapters.jms.api.MessageConverterException;
    import com.bea.wlevs.event.example.JDBC_CEP.ExchangeEvent;
    import javax.jms.JMSException;
    import javax.jms.Message;
    import javax.jms.TextMessage;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Random;
         public class Adapter_JDBC implements InboundMessageConverter{
         @SuppressWarnings("unchecked")
         public List convert(Message message) throws MessageConverterException, JMSException {
              Random rand = new Random();
              int unique_id = rand.nextInt();
              DateFormat dateFormat;
              dateFormat = DateFormat.getTimeInstance();
              dateFormat.format(new Date());
              MyLogger.info(unique_id + " CEP Start Time is: " + dateFormat.format(new Date()));
              System.out.println("Message from the Queue is :"+ message);
              TextMessage textMessage = (TextMessage) message;
              String stringMessage = textMessage.getText().toString();
              System.out.println("Message after getting converted into String is :"+ stringMessage);
                   String[] results = stringMessage.split(",\\s*"); // split on commas
                   ExchangeEvent event1 = new ExchangeEvent();
                   event1.setSYMBOL(results[0]);
         List events = new ArrayList(2);
         events.add(event1);
         return events;
    Output Bean Class :
    package com.bea.wlevs.bean.example.JDBC_CEP;
    import com.bea.wlevs.ede.api.StreamSink;
    import com.bea.wlevs.event.example.JDBC_CEP.ExchangeEvent;
    import com.bea.core.datasource.DataSourceService;
    public class OutputBean_JDBC implements StreamSink{
         public void onInsertEvent(Object event) {
         if (event instanceof ExchangeEvent) {
              ExchangeEvent cacheEvent = (ExchangeEvent) event;
         System.out.println("Symbol is: " + cacheEvent.getSymbol());
         System.out.println("Exchange is: " + cacheEvent.getExchange());
         System.out.println(DataSourceService.class.getClass());
    Kindly let me know if you need further info.

    Do you have StockDs configured in your server config.xml?
    I think the query should look more like this:
    SELECT stocks.SYMBOL, stocks.EXCHANGE
    FROM STOCK as stocks, ExchangeStream [Now] as datastream WHERE stocks.SYMBOL = datastream.SYMBOL
    Thanks
    andy

  • EJB 3.0 entity tables not getting created

    I'm trying to use EJB 3.0 and can't seem to get JDeveloper to create a table in the database for an EJB 3.0 entity.
    I'm using JDeveloper Studio Edition Version 10.1.3.1.0.3914 on WinXP SP 2, Java 1.5.0_06, with Oracle Express, running in the debugger using the embedded OC4J server.
    I have created 1 entity (Customer), 1 stateless session bean (CustomerFacade), and 1 JSF (index.jspx, which allows data entry to create a Customer entity). I'm able to input fields for a Customer instance on the index.jspx form, and transmit that to the CustomerFacadeBean to persist. The call to em.persist(entity) returns without error, however, when the transaction is committed, I get the following exception indicating that the table CUSTOMER does not exist.
    Partial Exception Trace:
    javax.faces.FacesException: #{customer.saveCustomer}: javax.faces.el.EvaluationException: javax.ejb.EJBException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701); nested exception is: oracle.oc4j.rmi.OracleRemoteException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    The full stack trace is at the bottom of this message if that will help.
    I want to generate the database schema from the EJB entities, and have setup persistence.xml to do so -- at least I think so.
    Following is all the relevant data. I sure hope someone can help with this. I've been struggling with various problems for days (for something that should just easily work) and I'm on a tight schedule. Please help!!
    persisence.xml:
    <?xml version="1.0" encoding="windows-1252" ?>
    <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"
    version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="SmashPU">
    <properties>
    <property name="toplink.logging.level" value="FINEST"/>
    <property name="toplink.ddl-generation" value="drop-and-create-tables"/>
    </properties>
    </persistence-unit>
    </persistence>
    Customer.java
    package com.toolcafe.model;
    import java.io.Serializable;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.NamedQuery;
    import javax.persistence.SequenceGenerator;
    import javax.persistence.TableGenerator;
    import javax.persistence.Version;
    @Entity
    @NamedQuery(name = "Customer.findAll", query = "select o from Customer o")
    @SequenceGenerator(name="myseq")
    public class Customer implements Serializable {
    private Integer id;
    private Integer version;
    private String firstName;
    private String lastName;
    private String emailAddr;
    public Customer() {
    @Id
    public Integer getId() {
    return id;
    public void setId(Integer id) {
    this.id = id;
    @Version
    public Integer getVersion() {
    return version;
    public void setVersion(Integer version) {
    this.version = version;
    public String getFirstName() {
    return firstName;
    public void setFirstName(String firstName) {
    this.firstName = firstName;
    public String getLastName() {
    return lastName;
    public void setLastName(String lastName) {
    this.lastName = lastName;
    public String getEmailAddr() {
    return emailAddr;
    public void setEmailAddr(String emailAddr) {
    this.emailAddr = emailAddr;
    Database Info:
    I created a schema called, "SMASH", in Oracle Express.
    he Offline Database Sources contain the Customer table, but only the ID and VERSION columns, as does the Oracle Express schema.
    Exception Trace:
    javax.faces.FacesException: #{customer.saveCustomer}: javax.faces.el.EvaluationException: javax.ejb.EJBException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701); nested exception is: oracle.oc4j.rmi.OracleRemoteException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
         at javax.faces.component.UICommand.broadcast(UICommand.java:332)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:287)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:401)
         at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:367)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:336)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:196)
         at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:105)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: javax.faces.el.EvaluationException: javax.ejb.EJBException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701); nested exception is: oracle.oc4j.rmi.OracleRemoteException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701)
         at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:150)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
         ... 25 more
    Caused by: javax.ejb.EJBException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701); nested exception is: oracle.oc4j.rmi.OracleRemoteException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.EJBUtils.createEJBException(EJBUtils.java:365)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.EJBUtils.createEJBException(EJBUtils.java:356)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.AbstractEJBObject.OC4J_handleUncheckedException(AbstractEJBObject.java:396)
         at CustomerFacade_RemoteProxy_51ldkeg.persistEntity(Unknown Source)
         at form.CustomerForm.saveCustomer(CustomerForm.java:66)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
         ... 26 more
    Caused by: oracle.oc4j.rmi.OracleRemoteException: An exception occurred during transaction completion: ; nested exception is:
         javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.EJBTransactionManager.end(EJBTransactionManager.java:141)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:57)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:87)
         ... 33 more
    Caused by: javax.transaction.RollbackException: returning error in transaction: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ApplicationServerTransaction.checkForRollbackOnlyWhileInCommit(ApplicationServerTransaction.java:582)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ApplicationServerTransaction.doCommit(ApplicationServerTransaction.java:247)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ApplicationServerTransaction.commit(ApplicationServerTransaction.java:130)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ApplicationServerTransactionManager.commit(ApplicationServerTransactionManager.java:433)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ejb.EJBTransactionManager.end(EJBTransactionManager.java:132)
         ... 39 more
    Caused by: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00942: table or view does not exist
    Error Code: 942
    Call:INSERT INTO CUSTOMER (ID, EMAILADDR, LASTNAME, VERSION, FIRSTNAME) VALUES (?, ?, ?, ?, ?)
         bind => [null, [email protected], Hart, 1, Rick]
    Query:InsertObjectQuery(com.toolcafe.model.Customer@11ca701)
         at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:295)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:639)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:688)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:477)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:437)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.executeCall(AbstractSession.java:675)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:213)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:199)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:331)
         at oracle.toplink.essentials.internal.queryframework.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:176)
         at oracle.toplink.essentials.internal.queryframework.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:192)
         at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:457)
         at oracle.toplink.essentials.queryframework.InsertObjectQuery.executeCommit(InsertObjectQuery.java:74)
         at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.performUserDefinedWrite(DatabaseQueryMechanism.java:635)
         at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.performUserDefinedInsert(DatabaseQueryMechanism.java:599)
         at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.insertObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:495)
         at oracle.toplink.essentials.queryframework.WriteObjectQuery.executeCommitWithChangeSet(WriteObjectQuery.java:130)
         at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:283)
         at oracle.toplink.essentials.queryframework.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:67)
         at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:609)
         at oracle.toplink.essentials.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:536)
         at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:123)
         at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:95)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2218)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:937)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:894)
         at oracle.toplink.essentials.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:254)
         at oracle.toplink.essentials.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:175)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:2638)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1030)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:353)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1112)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.issueSQLbeforeCompletion(UnitOfWorkImpl.java:2428)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.issueSQLbeforeCompletion(RepeatableWriteUnitOfWork.java:177)
         at oracle.toplink.essentials.transaction.AbstractSynchronizationListener.beforeCompletion(AbstractSynchronizationListener.java:116)
         at oracle.toplink.essentials.transaction.JTASynchronizationListener.beforeCompletion(JTASynchronizationListener.java:76)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ApplicationServerTransaction.callBeforeCompletion(ApplicationServerTransaction.java:1019)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.ApplicationServerTransaction.doCommit(ApplicationServerTransaction.java:246)
         ... 42 more
    Caused by: java.sql.SQLException: ORA-00942: table or view does not exist
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:633)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1161)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3001)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3074)
         at oracle.oc4j.sql.proxy.PreparedStatementBCELProxy.executeUpdate(PreparedStatementBCELProxy.java:37)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:632)
         ... 78 more

    You have to add the property toplink.ddl-generation.output-mode to your persistence.xml file, for example:
    <?xml version="1.0" encoding="windows-1252" ?>
    <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"
    version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="model">
    <jta-data-source>jdbc/jdm-akoDS</jta-data-source>
    <properties>
    <property name="toplink.logging.level" value="INFO"/>
    <property name="toplink.target-database" value="Oracle"/>
    <property name="toplink.ddl-generation" value="drop-and-create-tables"/>
    <property name="toplink.ddl-generation.output-mode" value="database"/>
    </properties>
    </persistence-unit>
    </persistence>

  • Can execut a query in Oracle UCM to get View_Values instead of using GET_SC

    Dear All,
    i have a question that i had google it and didn't find anything helpful.
    i want to ask if i can execut a query in Oracle UCM to get View_Values instead of using GET_SCHEMA_VIEW_VLAUES service ?
    ie: asuume that we have a Table name called Employees (having empId, empName) and have a view named as Table name; Employees.
    instead of use the GET_SCHEMA_VIEW_VLAUES service to get the data of Employees, can i write a query, ex: select from Employees*_ to get the data.
    note: i have a connection parameter to connect to oracle UCM database
    any suggestions.
    Regards

    Yes, you can execute the query and store results into a result set (available also in iDocScript).
    There are two sample components that you could use as a starting point - see here http://www.oracle.com/technetwork/middleware/webcenter/content/howtocomponentsbundle-132171.zip or here for 11g http://bexhuff.com/2011/03/howto-component-samples-for-oracle-ucm-11g
    Take a look at DataAccess and DatabaseProvider from the sample stack.

  • Oracle Materialized view tables not getting refreshed automatically.

    At Destination:--
    CREATE MATERIALIZED VIEW PROG_MEDIA
    TABLESPACE ONA_TS1
    BUILD IMMEDIATE
    REFRESH FAST with rowid
    START WITH SYSDATE
    NEXT SYSDATE+1/96
    AS (select /*+ PARALLEL(a,6) */ * from PROG_MEDIA@onair a);
    exec dbms_mview.refresh('PROG_MEDIA','C');
    At Source:--
    CREATE MATERIALIZED VIEW LOG ON ONAIR.PROG_MEDIA
    TABLESPACE MVLOG
    WITH ROWID;
    Fired manually:--
    13:00:43 SQL> exec dbms_mview.refresh('PROG_MEDIA','C');
    PL/SQL procedure successfully completed.
    At source:--
    13:18:35 SQL> select PROG_MEDIA_ID,PROG_MEDIA_NAME from PROG_MEDIA where PROG_MEDIA_ID='102226';
    PROG_MEDIA_ID
    PROG_MEDIA_NAME
    102226
    test
    At Destination:--
    14:03:28 SQL> select PROG_MEDIA_ID,PROG_MEDIA_NAME from PROG_MEDIA where PROG_MEDIA_ID='102226';
    PROG_MEDIA_ID PROG_MEDIA_NAME
    102226 UTSAV-5-162077
    JOB LOG_USER THIS_DATE LAST_DATE_TIME NEXT_DATE_TIME INTERVAL FAILURES WHAT
    242 ONAIR 17-05-11 14:17:24 SYSDATE+1/96 7 dbms_refresh.refresh('"ONAIR"."PROG_MEDI
    A"');
    242 ONAIR 17-05-11 14:32:25 SYSDATE+1/96 8 dbms_refresh.refresh('"ONAIR"."PROG_MEDI
    A"');
    1> I have scheduled this refresh job for every 15mins, but its not getting executed. Also my job_queue_process is '20'. Whenever i execute it manually it get's refresh.
    2> I can schedule a cron for the same for every 15mins but i really dont want to do it.
    Kindly help me out.

    Hi,
    I have created MV_CAPABILITIES_TABLE & executed below commands:--
    17:56:54 SQL> EXECUTE DBMS_MVIEW.EXPLAIN_MVIEW ('"ONAIR"."PROG_MEDIA"');
    PL/SQL procedure successfully completed.
    17:57:26 SQL> SELECT capability_name, possible, SUBSTR(related_text,1,8)
    17:57:27 2 AS rel_text, SUBSTR(msgtxt,1,60) AS msgtxt
    17:57:27 3 FROM MV_CAPABILITIES_TABLE
    17:57:27 4 ORDER BY seq;
    CAPABILITY_NAME P REL_TEXT MSGTXT
    PCT N
    PCT N
    REFRESH_COMPLETE Y
    REFRESH_COMPLETE Y
    REFRESH_FAST Y
    REFRESH_FAST Y
    REWRITE N
    REWRITE N
    PCT_TABLE N PROG_MED relation is not a partitioned table
    PCT_TABLE N PROG_MED relation is not a partitioned table
    REFRESH_FAST_AFTER_INSERT Y
    REFRESH_FAST_AFTER_INSERT Y
    REFRESH_FAST_AFTER_ONETAB_DML Y
    REFRESH_FAST_AFTER_ONETAB_DML Y
    REFRESH_FAST_AFTER_ANY_DML Y
    REFRESH_FAST_AFTER_ANY_DML Y
    REFRESH_FAST_PCT N PCT is not possible on any of the detail tables in the mater
    REFRESH_FAST_PCT N PCT is not possible on any of the detail tables in the mater
    REWRITE_FULL_TEXT_MATCH N PROG_MED mv references a remote table or view in the FROM list
    REWRITE_FULL_TEXT_MATCH N PROG_MED mv references a remote table or view in the FROM list
    REWRITE_FULL_TEXT_MATCH N query rewrite is disabled on the materialized view
    REWRITE_FULL_TEXT_MATCH N query rewrite is disabled on the materialized view
    REWRITE_PARTIAL_TEXT_MATCH N materialized view cannot support any type of query rewrite
    REWRITE_PARTIAL_TEXT_MATCH N materialized view cannot support any type of query rewrite
    REWRITE_PARTIAL_TEXT_MATCH N query rewrite is disabled on the materialized view
    REWRITE_PARTIAL_TEXT_MATCH N query rewrite is disabled on the materialized view
    REWRITE_GENERAL N materialized view cannot support any type of query rewrite
    REWRITE_GENERAL N materialized view cannot support any type of query rewrite
    REWRITE_GENERAL N query rewrite is disabled on the materialized view
    REWRITE_GENERAL N query rewrite is disabled on the materialized view
    REWRITE_PCT N general rewrite is not possible or PCT is not possible on an
    REWRITE_PCT N general rewrite is not possible or PCT is not possible on an
    PCT_TABLE_REWRITE N PROG_MED relation is not a partitioned table
    PCT_TABLE_REWRITE N PROG_MED relation is not a partitioned table
    34 rows selected.
    Elapsed: 00:00:00.09
    What to be done next?
    Also i fired the job manually by:--
    17:38:02 SQL> set serveroutput on
    17:39:45 SQL> EXEC DBMS_JOB.RUN(242);
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.48

  • Query 1 shows less consistent gets but more cost than Query 2..

    Hi ,
    SQL> select dname from scott.dept where deptno not in (select deptno from scott.emp)
    Ðñüãñáììá åêôÝëåóçò
    Plan hash value: 3547749009
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |    1 |    22 | 4 (0)| 00:00:01 |
    |*  1 |  FILTER            |      |       |       |            |          |
    |   2 |   TABLE ACCESS FULL| DEPT |     4 |    88 | 2 (0)| 00:00:01 |
    |*  3 |   TABLE ACCESS FULL| EMP  |    11 |   143 |  2 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter( NOT EXISTS (SELECT /*+ */ 0 FROM "SCOTT"."EMP" "EMP"
                  WHERE LNNVL("DEPTNO"<>:B1)))
       3 - filter(LNNVL("DEPTNO"<>:B1))
    Note
       - dynamic sampling used for this statement
    ÓôáôéóôéêÜ
              0  recursive calls
              0  db block gets
             15 consistent gets
              0  physical reads
              0  redo size
            416  bytes sent via SQL*Net to client
            384  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL>
    SQL> select dname from scott.dept,scott.emp where dept.deptno=emp.deptno(+)
      2    and emp.rowid is null;
    Ðñüãñáììá åêôÝëåóçò
    Plan hash value: 2146709594
    | Id  | Operation           | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT    |      |   12 |   564 | 5 (20)| 00:00:01 |
    |*  1 |  FILTER             |      |       |       |            |          |
    |*  2 |   HASH JOIN OUTER   |      |    12 |   564 | 5 (20)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL| DEPT |     4 |    88 | 2 (0)| 00:00:01 |
    |   4 |    TABLE ACCESS FULL| EMP  |    12 |   300 | 2 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("EMP".ROWID IS NULL)
       2 - access("DEPT"."DEPTNO"="EMP"."DEPTNO"(+))
    Note
       - dynamic sampling used for this statement
    ÓôáôéóôéêÜ
              0  recursive calls
              0  db block gets
              6 consistent gets
              0  physical reads
              0  redo size
            416  bytes sent via SQL*Net to client
            384  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processedI have two questions:
    1) which one is preferable.... the first which is less costy to the system or the second which causes less consistent gets to the system and so is considered to be more scalable..????
    2)Whereas the number of rows returned by both queries is 1.. why the is difference in the underlined values in the two queries (values 1 and 12 respectively)?
    I use Oracle10g v.2
    Thanks.. a lot
    Sim

    The less logical I/O's the better.
    So always do it like your query 2 (btw. your title is the wrong way)
    Your example is probably flawed. If I try it in SQL*Plus I get correct results:
    SQL> get t
      1* select dname from dept where deptno not in (select deptno from emp)
    SQL> /
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=6 Card=3 Bytes=39)
       1    0   FILTER
       2    1     TABLE ACCESS (FULL) OF 'DEPT' (TABLE) (Cost=2 Card=4 Bytes=52)
       3    1     TABLE ACCESS (FULL) OF 'EMP' (TABLE) (Cost=2 Card=1 Bytes=3)
    Statistics
              0  recursive calls
              0  db block gets
             15  consistent gets
              0  physical reads
              0  redo size
            537  bytes sent via SQL*Net to client
            660  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> get tt
      1  select dname from dept,emp where dept.deptno=emp.deptno(+)
      2* and emp.rowid is null
    SQL> /
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=5 Card=14 Bytes=322)
       1    0   FILTER
       2    1     HASH JOIN (OUTER) (Cost=5 Card=14 Bytes=322)
       3    2       TABLE ACCESS (FULL) OF 'DEPT' (TABLE) (Cost=2 Card=4 Bytes=52)
       4    2       TABLE ACCESS (FULL) OF 'EMP' (TABLE) (Cost=2 Card=14 Bytes=140)
    Statistics
              0  recursive calls
              0  db block gets
              6  consistent gets
              0  physical reads
              0  redo size
            537  bytes sent via SQL*Net to client
            660  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> I'm wondering for instance why you have there 11 rows in emp for query 1 (should be only 1 row) and why you have only 12 rows in query 2 (should be 14 rows)

  • How can I get list of columns used of specific table in all stored procedure?

    How can I get used column list of a specific table in among all stored procedure?
    Suppose that,
    I have a table(VendorMaster) which has 100 columns just I want to know how many columns used in among all stored procedure.

    We have solved by below query...
    IF OBJECT_ID('tempdb.dbo.#SPDependencyDetails') IS NOT NULL
    DROP TABLE #SPDependencyDetails
    CREATE TABLE #SPDependencyDetails
     Or_Object_Database NVARCHAR(128)
    ,Or_Object_Name NVARCHAR(128)
    ,Ref_Database_Name NVARCHAR(128)
    ,Ref_Schema_Name NVARCHAR(128)
    ,Ref_Object_Name NVARCHAR(128)
    ,Ref_Column_Name NVARCHAR(128)
    ,Is_Selected BIT
    ,Is_Updated BIT
    ,Is_Select_All BIT
    ,Is_All_Columns_Found BIT
    DECLARE @database_name VARCHAR(100)
    DECLARE database_cursor CURSOR
    FOR
    SELECT name
        FROM sys.databases
        WHERE database_id =8
    OPEN database_cursor
    FETCH NEXT FROM database_cursor
    INTO @database_name
    WHILE @@FETCH_STATUS = 0 --Outer Loop begin
    BEGIN
        DECLARE  @WholeLotofSQL NVARCHAR(MAX) =       '
        DECLARE @object_name VARCHAR(150)
        ,@sqlstatement NVARCHAR(2500)
        DECLARE object_cursor CURSOR --Inner cursor, iterates list of objects that match type
        FOR
            SELECT name
                FROM '+@database_name+'.sys.objects AS o
                WHERE o.type = ''P'' --Change Object type to find dependencies of Functions, Views and etc.
                ORDER BY 1    
        OPEN object_cursor
        FETCH NEXT FROM object_cursor INTO @object_name
        WHILE @@FETCH_STATUS = 0  --Inner Loop Begin
            BEGIN
                SET @sqlstatement = ''USE '+@database_name+';
                                    INSERT INTO #SPDependencyDetails
                                    SELECT DB_NAME() AS Or_Object_Database
                                            ,'''''' + @object_name + '''''' AS Or_Object_Name
                                            ,CASE WHEN referenced_database_name IS NULL THEN DB_NAME()
                                                    ELSE referenced_database_name
                                            END AS Ref_Database_Name
                                            ,referenced_schema_name AS Ref_Schema_Name
                                            ,referenced_entity_name AS Ref_Object_Name
                                            ,referenced_minor_name AS Ref_Column_Name
                                            ,is_selected
                                            ,is_updated
                                            ,is_select_all
                                            ,is_all_columns_found
                                        FROM sys.dm_sql_referenced_entities(''''dbo.'' + @object_name + '''''', ''''OBJECT'''');''
                EXEC sys.sp_executesql @sqlstatement
                FETCH NEXT FROM object_cursor INTO @object_name
            END      
        CLOSE object_cursor
        DEALLOCATE object_cursor'
        EXEC sys.sp_executesql @WholeLotofSQL
        FETCH NEXT FROM database_cursor INTO @database_name
    END
    CLOSE database_cursor;
    DEALLOCATE database_cursor;
    SELECT Or_Object_Database as 'Database'
    ,Or_Object_Name as 'Procedure'
    ,Ref_Object_Name as 'Table'
    ,Ref_Column_Name as 'Column'
    FROM #SPDependencyDetails

  • While Joining 3 tables am getting 2 rows,actual i need a single row

    Hi all,
        While joining 3 tables am getting 2 Rows, i need  1 row.
    please find my query and actual output and expected output.
    Help me out to handle this.
    select
            --MFU_D_C_INVESTOR_ID_DET,
            mfu_remove_junk(Q.CAN)                               CAN_ST,
            mfu_remove_junk(Q.INSTALLMENT_AMOUNT) AMOUNT_ST,
            mfu_remove_junk(x.Can )                                Can ,
            mfu_remove_junk(x.Amc_Code )                      Amc_Code ,
            mfu_remove_junk(x.Folio_No )                         Folio_No ,
            mfu_remove_junk(x.Order_Status )                  Order_Status ,
            mfu_remove_junk(x.User_Code )                    User_Code ,
            mfu_remove_junk(x.User_Txrn_No )               User_Txrn_No ,
            mfu_remove_junk(x.Group_Ord_No )              Group_Ord_No ,
            mfu_remove_junk(x.Ind_Txn_Ref_No )            Ind_Txn_Ref_No ,
            mfu_remove_junk(x.Pending_Txn_Ref_No )    Pending_Txn_Ref_No ,
            mfu_remove_junk(x.Appl_No )                       Appl_No ,
            mfu_remove_junk(x.Ts_Machine_Id )             Ts_Machine_Id ,
            mfu_remove_junk(x.Trxn_Date )                    Trxn_Date ,
            mfu_remove_junk(x.Trxn_Time )                    Trxn_Time ,
            mfu_remove_junk(x.Timestamp_No )             Timestamp_No ,
            mfu_remove_junk(x.Sch_Code )                   Sch_Code ,
            mfu_remove_junk(x.Reinv_Tag )                    Reinv_Tag ,
            mfu_remove_junk(x.Txn_Mode )                   Txn_Mode ,
            mfu_remove_junk(x.Trxn_Type )                   Trxn_Type ,
            mfu_remove_junk(x.Sub_Trxn_Type )           Sub_Trxn_Type ,
            mfu_remove_junk(x.Units )                          Units ,
            mfu_remove_junk(x.Amount )                      Amount ,
            mfu_remove_junk(x.All_Units_Flag )            All_Units_Flag ,
            mfu_remove_junk(x.Entity_Id )                    Entity_Id ,
            mfu_remove_junk(x.ENTITY_BRANCH_ID )  ENTITY_BRANCH_ID ,
            mfu_remove_junk(x.Location )                     Location ,
           (TO_CHAR(sysdate,'DD-MON-RRRR'))        CREATED_DATE
         From MFU_FTP_XML_FILES T
      Left Join Xmltable('/COMM_TXN_STRUCT/FILE_ROWS/FILE_ROW'
                          Passing T.Filecontent
                          Columns
    --MFU_D_C_INVESTOR_ID_DET
    Can                 Varchar2(500) Path  'INVESTOR_ID_DET/CAN',
    Amc_Code            Varchar2(500) Path  'INVESTOR_ID_DET/AMC_CODE',
    Folio_No            Varchar2(500) Path  'INVESTOR_ID_DET/FOLIO_NO',
    Order_Status        Varchar2(500) Path  'TRANSACTION_DET/ORDER_STATUS',
    User_Code           Varchar2(500) Path  'TRANSACTION_DET/USER_CODE',
    User_Txrn_No        Varchar2(500) Path  'TRANSACTION_DET/USER_TXRN_NO',
    Group_Ord_No        Varchar2(500) Path  'TRANSACTION_DET/GROUP_ORD_NO',
    Ind_Txn_Ref_No      Varchar2(500) Path  'TRANSACTION_DET/IND_TXN_REF_NO',
    Pending_Txn_Ref_No  Varchar2(500) Path  'TRANSACTION_DET/PENDING_TXN_REF_NO',
    Appl_No             Varchar2(500) Path  'TRANSACTION_DET/APPL_NO',
    Ts_Machine_Id       Varchar2(500) Path  'TRANSACTION_DET/TS_MACHINE_ID',
    Trxn_Date           Varchar2(500) Path  'TRANSACTION_DET/TRXN_DATE',
    Trxn_Time           Varchar2(500) Path  'TRANSACTION_DET/TRXN_TIME',
    Timestamp_No        Varchar2(500) Path  'TRANSACTION_DET/TIMESTAMP_NO',
    Sch_Code            Varchar2(500) Path  'TRANSACTION_DET/SCH_CODE',
    Reinv_Tag           Varchar2(500) Path  'TRANSACTION_DET/REINV_TAG',
    Txn_Mode            Varchar2(500) Path  'TRANSACTION_DET/TXN_MODE',
    Trxn_Type           Varchar2(500) Path  'TRANSACTION_DET/TRXN_TYPE',
    Sub_Trxn_Type       Varchar2(500) Path  'TRANSACTION_DET/SUB_TRXN_TYPE',
    Units               Varchar2(500) Path  'TRANSACTION_DET/UNITS',
    Amount              Varchar2(500) Path  'TRANSACTION_DET/AMOUNT',
    All_Units_Flag      Varchar2(500) Path  'TRANSACTION_DET/ALL_UNITS_FLAG',
    Entity_Id           Varchar2(500) Path  'TRANSACTION_DET/ENTITY_ID',
    ENTITY_BRANCH_ID    Varchar2(500) Path  'TRANSACTION_DET/ENTITY_BRANCH_ID',
    Location            Varchar2(500) Path  'TRANSACTION_DET/LOCATION'
    ) X
    on (1=1)
         left join XMLTABLE('/CT_SYS_STRUCT/FILE_ROWS/FILE_ROW'
                   PASSING T.FILECONTENT
                   columns
    CAN                varchar2(500)  PATH 'INVESTOR_ID_DET/CAN',
    INSTALLMENT_AMOUNT varchar2(500)  PATH 'TRANSACTION_DET/INSTALLMENT_AMOUNT'
    )Q
    on (1=1)
    Where
    TRUNC((TO_DATE(T.RETRIVED_DATE,'DD-MON-RRRR HH:MI:SS PM')))=TRUNC(SYSDATE-2)
    Order By Rownum,X.Can Asc;
    Actual O/P:
    15114LBA01  1000.00     (null)               (null)         (null)     (null)      (null)                 (null)               (null)                  
            (null)      (null)         15114LBA01    SMF         AC       MFU    40715117000    15114010001   1511401000102      
    Expected O/P:
    can_st                amount     can                 amc    order  user      trxn_no             group_ord         ind_txn_no
       15114LBA01   1000.00  
    15114LBA01    SMF 
    AC 
    MFU    40715117000    15114010001    1511401000102 

    Expected O/P:
    can_st      amount  can       amc order user trxn_no     group_ord   ind_txn_no
    15114LBA01 1000.00 15114LBA01 SMF
    AC
       MFU 40715117000 15114010001 1511401000102
    check http://docs.oracle.com/cd/E11882_01/server.112/e41084/ap_keywd001.htm#SQLRF55621
    to verify:
    with
    actual_output as
    (select '15114LBA01' can_st,1000.00 amount,null can,null amc,null order_,null user_,null trxn_no,null group_ord,null ind_txn_no from dual union all
    select null,null,'15114LBA01','SMF','AC','MFU',40715117000,15114010001,1511401000102 from dual
    select max(can_st) can_st,max(amount) amount,max(can) can,max(amc) amc,max(order_) order_,max(user_) user_,max(trxn_no) trxn_no,max(group_ord) group_ord,max(ind_txn_no) ind_txn_no
      from actual_output
    CAN_ST
    AMOUNT
    CAN
    AMC
    ORDER_
    USER_
    TRXN_NO
    GROUP_ORD
    IND_TXN_NO
    15114LBA01
    1000
    15114LBA01
    SMF
    AC
    MFU
    40715117000
    15114010001
    1511401000102
    select max(can_st) can_st,max(amount) amount,max(can) can,max(amc) amc,max(order_) order,max(user_) user,max(trxn_no) trxn_no,max(group_ord) group_ord,max(ind_txn_no) ind_txn_no
      from actual_output
    ORA-00923: FROM keyword not found where expected
    Regards
    Etbin

  • Parse comma separated value and map with other table to get Name and change it back to comma separate.

    Hi,
    I have one existing view(with around 15 fields), in which I have to add few more fields from table called PI.
    Now these fields have values like (55C4444F-D83B-4F96-A011-367A3755BA6C , F52388E2-485B-49DF-8534-FDF46D23F59E , 722432E1-F063-4CBD-B83D-1B97836E82953) 3 values comma separated.(Sometimes only one value and sometimes 4 or 5 or 7-8 depend on user has entered
    on web page)
    Also I have another table called PHA and this tables has 2 fields Values and Name so I have to map this two tables based on VALUES fields and get Name from this PHA table and show in view and that also Comma separated.
    So basically I have to Parse the PI table's Values field 1st, map it with PHA table to get Name and then Make it comma separated in that existing view.
    To make fields comma separate I used below query,
    (SELECT DISTINCT SUBSTRING
                SELECT ','+ PI.[Name]  AS [text()]
                FROM [DB].[dbo].[Table] PHA1
    Inner Join  [DB].[dbo].[Table] PI
    ON PHA.[Value] = PI.[VALUE]
                WHERE PHA1.PId =PHA2.PId and PHA1.CId = PHA2.CId
                ORDER BY PHA1.PId
                For XML PATH ('')
            ), 2, 1000) 
    FROM [DB].[dbo].[Table] PHA2
    Inner Join [cSharpSite_profiles].[dbo].[PetAllergies] PA
    Inner Join  [DB].[dbo].[Table] PI
    ON PHA.[Value] = PI.[VALUE]
    ) [Name]
    Vicky

    Wait, this sounds wrong. You have a view where you group values into a comma-separated list. While that surely will make some purists cringe, I can see that it makes sense from a presentation perspective.
    But if you want to use these concatenated values as atomic values again, you should go back to the base tables and them from there. Building views on views may sometimes be a good idea, but if you are too keen on reuse you can cause a performance disaster.
    So do it right from the beginning.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Joining three tables to get totals on three columns.

    hi gurus,
    i have spent hours and hours to get the desired result with this join query. 98% of the query bring results according to my expectations but for some reasons few results are duplicating. let me give you the structure of my tables than my query and than what i expect it to bring. here we go;
    There are three tables
    *1. SENDER*
    Name Null? Type
    SNAME VARCHAR2(50)
    SPHONE1 NOT NULL VARCHAR2(15)
    SPHONE2 VARCHAR2(15)
    SPHONE3 VARCHAR2(15)
    SCITY VARCHAR2(25)
    SREMARKS VARCHAR2(200)
    IDENTIFICATION VARCHAR2(20)
    ADD1 VARCHAR2(30)
    ADD2 VARCHAR2(30)
    *2. TRANSACTION*
    Name Null? Type
    T_ID NOT NULL NUMBER
    SPHONE1 VARCHAR2(15)
    R_ID NUMBER
    RB_ID VARCHAR2(10)
    TRANSFER_TO VARCHAR2(25)
    TDATE DATE
    SOURCE VARCHAR2(20)
    CURR VARCHAR2(10)
    PAID VARCHAR2(10)
    MOP VARCHAR2(10)
    DOLLAR NUMBER
    RATE NUMBER(5,2)
    RUPPEE NUMBER
    TREM1 VARCHAR2(200)
    TREM2 VARCHAR2(100)
    PPAYMENT VARCHAR2(10)
    PROMISE VARCHAR2(50)
    BALANCE NUMBER
    DOLLAR2 NUMBER
    *3. PAYMENTS*
    Name Null? Type
    PAYMENT_ID NOT NULL NUMBER
    PDATE DATE
    SPHONE1 VARCHAR2(15)
    AMT_PAID NUMBER
    BALANCE NUMBER
    T_ID NUMBER
    QUERY_
    select a.sname, a.sphone1, nvl(sum(b.dollar),0) ORD, nvl(sum(b.dollar2),0) ADV,
    nvl(sum(c.amt_paid),0) Paid
    from sender a, transaction b, payments c
    where a.sphone1 = b.sphone1
    and b.t_id = c.t_id(+)
    and b.paid in ('N','B')
    group by a.sname, a.sphone1
    order by 1
    HERE IS THE RESULT OF THIS QUERY:_
    SNAME SPHONE1 ORD ADV PAID
    Muhammad Atif Ishtiaq 778 889 7195 2150 635 45
    BRIEF DESCRIPTION:*
    We have sender info in SENDER table, when they place order it goes to TRANSACTION table and when they pay it goes into PAYMENTS. some times they make payments in installment of a single order. which i record them in payments with their T_ID (Transaction ID) and this is the problem what i research until now. many customers place multiple orders over a period of time but dont pay and some times pay the orders in installment. i just want to present the whole story in one single row, as i mentioned above under query result. in this example the actual ORD suppose to be $2050 instead and ADV $605. PAID is OK.
    SQL> select t_id, dollar, dollar2 from transaction where paid = 'B' and sphone1 = '778 889 7195';
    T_ID DOLLAR DOLLAR2
    18274 450
    18278 1000 500
    18263 100 30
    18265 100
    18266 100
    18268 100 25
    18269 200 50
    SQL> select t_id, amt_paid from payments
    where t_id in (select t_id from transaction
    where paid = 'B' and sphone1 = '778 889 7195')
    T_ID AMT_PAID
    18263 20
    18263 25
    AND in the end i would like to calculate balance of the columns ((ORD+ADV) - (PAID))
    Any help would be appreciated.
    best regards.
    NOTE: i am running oracle 8 and developer 6i

    try this:
    WITH TRANSACTION AS (select 18274 t_id, 450 dollar, NULL dollar2, '778 889 7195' sphone1 FROM DUAL
                         UNION ALL
                         select 18278 t_id, 1000 dollar, 500 dollar2, '778 889 7195' sphone1 FROM DUAL
                         UNION ALL
                         select 18263 t_id, 100 dollar, 30 dollar2, '778 889 7195' sphone1 FROM DUAL
                         UNION ALL
                         select 18265 t_id, 100 dollar, NULL dollar2, '778 889 7195' sphone1 FROM DUAL
                         UNION ALL
                         select 18266 t_id, 100 dollar, NULL dollar2, '778 889 7195' sphone1 FROM DUAL
                         UNION ALL
                         select 18268 t_id, 100 dollar, 25 dollar2, '778 889 7195' sphone1 FROM DUAL
                         UNION ALL
                         select 18269 t_id, 200 dollar, 50 dollar2, '778 889 7195' sphone1 FROM DUAL
         PAYMENTS AS    (select 18263 t_id, 20 amt_paid FROM DUAL
                         UNION ALL
                         select 18263 t_id, 25 amt_paid FROM DUAL
         SENDER AS      (SELECT 'Muhammad Atif Ishtiaq' SNAME, '778 889 7195' SPHONE1 FROM DUAL
    select a.sname,
           a.sphone1,
           nvl(ORD,0) ORD,
           nvl(ADV,0) ADV,
           nvl(amt_paid,0) Paid
      from sender a,
           (SELECT sphone1,
                   sum(dollar) ord,
                   sum(dollar2) adv
              from transaction b
            GROUP BY sphone1) b,
           (SELECT sphone1,
                   SUM(amt_paid) amt_paid
              FROM payments p,
                   transaction t
             where p.t_id=t.t_id
             GROUP BY sphone1) c
    where a.sphone1 = b.sphone1
    and b.sphone1=c.sphone1(+);

  • Can't get JDeveloper/OC4J to auto-create MySQL table

    My EJB 3.0 based application is failing to create the MySQL table specified by the @TableGenerator annotation.
    Following are the details of my setup and application:
    System Setup:
    - JDeveloper 10.1.3.1.0
    - JDK 1.5.0_07
    - Ubuntu Linux kernel 2.6.15-27-k7
    - MySQL 5.0
    - MySQL ConnectorJ 3.1.13
    - Using the embedded OC4J server.
    I have done the following so far:
    1. Created a database in MySQL called, "test". Did not create any tables.
    2. Created a JDeveloper library whose classpath contains the MySQL ConnectorJ JAR file, and tested a database connection from JDeveloper successfully.
    3. Added the MySQL/JDeveloper library to my ejb project, "Test1/Model", and selected the database connection from the project properties EJB panel. The database connector is called, "SmashDB". Selecting the database connector on the EJB panel resulted in JDeveloper setting "SmashDBDS" as the default datasource.
    A JSF managed bean calls an EJB Session Bean, CustomerFacadeBean.persistEntity(Customer customer) with a Customer object as a parameter to save in the database. OC4J successfully connects to the MySQL "test" database, but fails when trying to access the ID_GENERATOR table, which is specified in an @TableGenerator annotation. The class-level annotations in the Customer entity are as follows:
    @Entity
    @NamedQuery(name = "Customer.findAll", query = "select o from Customer o")
    @TableGenerator(name = "BasicIDGen", table = "ID_GENERATOR", pkColumnName = "GEN_KEY",
    pkColumnValue = "CUSTOMER_ID", valueColumnName = "GEN_VALUE")
    public class Customer implements Serializable {
    private Long id;
    private Integer version;
    private String firstName;
    private String lastName;
    private String emailAddr;
    My persistence.xml file contains:
    <?xml version="1.0" encoding="UTF-8" ?>
    <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"
    version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="Model">
    <properties>
    <property name="toplink.ddl-generation" value="drop-and-create-tables"/>
    </properties>
    </persistence-unit>
    </persistence>
    With the above definition for Customer and persistence.xml, I expected the ID_GENERATOR and CUSTOMER tables to be created automatically, but this doesn't seem to be happening.
    Instead, I get the following error message and stack trace:
    2006-09-27 12:25:29.564 ERROR J2EE EJB-08006 [CustomerFacade:public java.lang.Object facade.CustomerFacadeBean.persistEntity(java.lang.Object)] exception occurred during method invocation: oracle.oc4j.rmi.OracleRemoteException: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: Table 'test.ID_GENERATOR' doesn't existError Code: 1146
    Call:UPDATE ID_GENERATOR SET GEN_VALUE = GEN_VALUE + ? WHERE GEN_KEY = ?
         bind => [50, CUSTOMER_ID]
    Query:DataModifyQuery(); nested exception is:
         Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: Table 'test.ID_GENERATOR' doesn't existError Code: 1146
    Call:UPDATE ID_GENERATOR SET GEN_VALUE = GEN_VALUE + ? WHERE GEN_KEY = ?
         bind => [50, CUSTOMER_ID]
    etc.....
    Help would be greatly appreciated. I've gotten to this point, which appears to be one error away from success (I hope) but don't have a clue what this problem is caused by.
    Thanks,
    Rick Horowitz

    darby wrote:
    I can't get this to compile. help!
    You can not issue DDL in PL/SQL. You need to use dynamic SQL for that:
    create or replace
    PROCEDURE CREATE_STAGING_TABLES as
    BEGIN
      -- I CAN'T GET THIS TO WORK BUT I CAN COPY THESE LINES AND RUN THEM AND THEY WORK! WHATUP?
      DBMS_OUTPUT.PUT_LINE('Begin Create Import Tables');
      EXECUTE IMMEDIATE 'Create table FAC_STAGING_PROJECTS As select * from FAC_PROJECTS where 1=2';
        EXECUTE IMMEDIATE 'alter table FAC_STAGING_PROJECTS add(ERROR_DESCRIPTION VARCHAR2(4000 CHAR))';
        EXECUTE IMMEDIATE 'alter table FAC_STAGING_PROJECTS add(bImported NUMBER)';
        EXECUTE IMMEDIATE 'alter table FAC_STAGING_PROJECTS add(dteImported DATE)';
      EXECUTE IMMEDIATE 'Create table FAC_STAGING_PURCHASE_ORDERS As select * from FAC_PURCHASE_ORDERS where 1=2';
        EXECUTE IMMEDIATE 'alter table FAC_STAGING_PURCHASE_ORDERS add(ERROR_DESCRIPTION VARCHAR2(4000 CHAR))';
        EXECUTE IMMEDIATE 'alter table FAC_STAGING_PURCHASE_ORDERS add(bImported NUMBER)';
        EXECUTE IMMEDIATE 'alter table FAC_STAGING_PURCHASE_ORDERS add(dteImported DATE)';
      DBMS_OUTPUT.PUT_LINE('End Create Import Tables'); 
      EXCEPTION
       WHEN OTHERS THEN
         raise_application_error(-20022,substr(SQLERRM,1,255));
    END CREATE_STAGING_TABLES;SY.
    P.S. I am not questioning why do you need to create tables from a stored procedure.

  • JSP Table Editing (Getting Specific Row)

    Hi there,
    I want to ask how do i get a specific row on my jsp table with a column containing "Edit" buttons.
    I want that when the user click the "Edit" button It will return the data of the selected row.
    Hope you could help me with this.
    Thank you and God Bless

    The logic is simple...
    Just store the primary key Id with each of the edit buttons.
    <input type="hidden" name="tempId">
    <input type="button" name="xyz" value="Edit" onClick="callEdit(<%=primaryKeyId%>)">Write a JS function as below ...
    <script>
    function callEdit(key)
       document.forms[0].tempId.value=key;
       document.forms[0].submit();
    </script>When the user clicks this button then the passed Id can be queried in your DB to retreive the values specific to that row.

Maybe you are looking for

  • Two iphones different accounts one itunes library?

    My wife and I each have an iphone 4 each with its own apple account.  Can I sync both phones in itunes on a Windows PC using one itunes library.  We share the same media files.  Do I have to set up two Windows user accounts and two different librarie

  • Issue in Workflow - Records not created at times

    Hi All, We are using oracle workflow. I am facing an issue in live at times. Here in my case a procedure is called from a workflow function which in turn inserts records in a table automatically. Some times even though all conditions met to insert re

  • Migration from iPhoto '08 to Photos

    Hi, 2 main questions: migration from iPoto '08 to Photos preservation of printed media Information: Hardware: MacBook Pro (Fall 2008, Early 2009) 15-inch with 2.4 GHz Intel Core 2 Duo Processor a and 2GB memory OS: Mac OSX Leopard (v 10.5.8) Currentl

  • Help - can't edit entries on calendar - phone is worthless to me....

    My Droid X finally arrived today. I synced my new phone to my google calendar today. I cannot edit any event that was synced, but can edit events created on the phone. I have been on the phone with Verizon, who transferred me to Motorola for almost 2

  • Uploading the pricing master records using bapi

    Hi I have to transfer the pricing database from legacy to SAP using bapi but I am not able to find a bapi for that. Pls guide.