Access pre-insert data using ViewObjects

Hi,
I’m trying to access pre-insert data (before super.doCommit() execution) using viewobjects, but I only obtain committed data. Is it possible to obtain pre-insert data using viewobjects?
Here the Java code:
String amDef = "oracle.srdemo.model.AppModule";
String config = "AppModuleLocal";
ApplicationModule am =
Configuration.createRootApplicationModule(amDef, config);
ViewObject vo = am.findViewObject("DatetestView1");
System.out.println("Query will return "+ vo.getEstimatedRowCount()+" rows...");
vo.executeQuery();
while (vo.hasNext()) {
Row curPerson = vo.next();
System.out.println(vo.getCurrentRowIndex()+". "+
curPerson.getAttribute("Id")+" "+
curPerson.getAttribute("Dataini"));
Configuration.releaseRootApplicationModule(am, true);
I'm using JDeveloper 11g, a Fusion Web Application and ADF Business Components
Thanks in advance.

Hi Timo,
According to your instructions, I obtained current ApplicationModule and the issue was solved.
Here the Java Code to get ApplicationModule from Iterator:
BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding dciter = (DCIteratorBinding)bindings.get("DatetestView1Iterator");
DCDataControl dc = dciter.getDataControl();
ApplicationModule am = (ApplicationModule)dc.getDataProvider();
AppModuleImpl am2 = (AppModuleImpl)am;
ViewObject vo = (DatetestViewImpl)am2.findViewObject("DatetestView1");
Thank you vey much,
Olga

Similar Messages

  • Error while insert data using execute immediate in dynamic table in oracle

    Error while insert data using execute immediate in dynamic table created in oracle 11g .
    first the dynamic nested table (op_sample) was created using the executed immediate...
    object is
    CREATE OR REPLACE TYPE ASI.sub_mark AS OBJECT (
    mark1 number,
    mark2 number
    t_sub_mark is a class of type sub_mark
    CREATE OR REPLACE TYPE ASI.t_sub_mark is table of sub_mark;
    create table sam1(id number,name varchar2(30));
    nested table is created below:
    begin
    EXECUTE IMMEDIATE ' create table '||op_sample||'
    (id number,name varchar2(30),subject_obj t_sub_mark) nested table subject_obj store as nest_tab return as value';
    end;
    now data from sam1 table and object (subject_obj) are inserted into the dynamic table
    declare
    subject_obj t_sub_mark;
    begin
    subject_obj:= t_sub_mark();
    EXECUTE IMMEDIATE 'insert into op_sample (select id,name,subject_obj from sam1) ';
    end;
    and got the below error:
    ORA-00904: "SUBJECT_OBJ": invalid identifier
    ORA-06512: at line 7
    then when we tried to insert the data into the dynam_table with the subject_marks object as null,we received the following error..
    execute immediate 'insert into '||dynam_table ||'
    (SELECT

    887684 wrote:
    ORA-00904: "SUBJECT_OBJ": invalid identifier
    ORA-06512: at line 7The problem is that your variable subject_obj is not in scope inside the dynamic SQL you are building. The SQL engine does not know your PL/SQL variable, so it tries to find a column named SUBJECT_OBJ in your SAM1 table.
    If you need to use dynamic SQL for this, then you must bind the variable. Something like this:
    EXECUTE IMMEDIATE 'insert into op_sample (select id,name,:bind_subject_obj from sam1) ' USING subject_obj;Alternatively you might figure out to use static SQL rather than dynamic SQL (if possible for your project.) In static SQL the PL/SQL engine binds the variables for you automatically.

  • Restful service unable to insert data using PL/SQL.

    Hi all,
    Am running: AL 2.01 standalone mode on OEL 4.8 in VM box A.
    Oracle database 10.2.0.4 with Apex 4.2.0.00.27 on OEL4.8 in VM box B.
    Able to performed oracle.example.hr Restful services with no problem.
    Unable to insert data using AL 2.0.1 but works on AL 1.1.4.
    which uses the following table (under schema: scott):
    create table json_demo ( title varchar2(20), description varchar2(1000) );
    grant all on json_demo to apex_public_user; and below procedure ( scott's schema ):
    CREATE OR REPLACE
    PROCEDURE post(
        p_url     IN VARCHAR2,
        p_message IN VARCHAR2,
        p_response OUT VARCHAR2)
    IS
      l_end_loop BOOLEAN := false;
      l_http_req utl_http.req;
      l_http_resp utl_http.resp;
      l_buffer CLOB;
      l_data       VARCHAR2(20000); 
      C_USER_AGENT CONSTANT VARCHAR2(4000) := 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)';
    BEGIN
      -- source: http://awads.net/wp/2005/11/30/http-post-from-inside-oracle/
      -- Ask UTL_HTTP not to raise an exception for 4xx and 5xx status codes,
      -- rather than just returning the text of the error page.
      utl_http.set_response_error_check(false);
      -- Begin the post request
      l_http_req := utl_http.begin_request (p_url, 'POST', utl_http.HTTP_VERSION_1_1);
      -- Set the HTTP request headers
      utl_http.set_header(l_http_req, 'User-Agent', C_USER_AGENT);
      utl_http.set_header(l_http_req, 'content-type', 'application/json;charset=UTF-8');
      utl_http.set_header(l_http_req, 'content-length', LENGTH(p_message));
      -- Write the data to the body of the HTTP request
      utl_http.write_text(l_http_req, p_message);
      -- Process the request and get the response.
      l_http_resp := utl_http.get_response (l_http_req);
      dbms_output.put_line ('status code: ' || l_http_resp.status_code);
      dbms_output.put_line ('reason phrase: ' || l_http_resp.reason_phrase);
      LOOP
        EXIT
      WHEN l_end_loop;
        BEGIN
          utl_http.read_line(l_http_resp, l_buffer, true);
          IF(l_buffer IS NOT NULL AND (LENGTH(l_buffer)>0)) THEN
            l_data    := l_data||l_buffer;
          END IF;
        EXCEPTION
        WHEN utl_http.end_of_body THEN
          l_end_loop := true;
        END;
      END LOOP;
      dbms_output.put_line(l_data);
      p_response:= l_data;
      -- Look for client-side error and report it.
      IF (l_http_resp.status_code >= 400) AND (l_http_resp.status_code <= 499) THEN
        dbms_output.put_line('Check the URL.');
        utl_http.end_response(l_http_resp);
        -- Look for server-side error and report it.
      elsif (l_http_resp.status_code >= 500) AND (l_http_resp.status_code <= 599) THEN
        dbms_output.put_line('Check if the Web site is up.');
        utl_http.end_response(l_http_resp);
        RETURN;
      END IF;
      utl_http.end_response (l_http_resp);
    EXCEPTION
    WHEN OTHERS THEN
      dbms_output.put_line (sqlerrm);
      raise;
    END; and executing in sqldeveloper 3.2.20.09 when connecting directly to box B as scott:
    SET serveroutput ON
    DECLARE
      l_url      VARCHAR2(200)   :='http://MY_IP:8585/apex/demo';
      l_json     VARCHAR2(20000) := '{"title":"thetitle","description":"thedescription"}';
      l_response VARCHAR2(30000);
    BEGIN
      post( p_url => l_url, p_message =>l_json, p_response => l_response);
    END;which resulted in :
    anonymous block completed
    status code: 200
    reason phrase: OK
    with data inserted. Setup using 2.0.1
       Workspace : wsdemo
    RESTful Service Module:  demo/
              URI Template:      test
                    Method:  POST
               Source Type:  PL/SQLand executing in sqldeveloper 3.2.20.09 when connecting directly to box B as scott:
    SET serveroutput ON
    DECLARE
      l_url      VARCHAR2(200)   :='http://MY_IP:8585//apex/wsdemo/demo/test';
      l_json     VARCHAR2(20000) := '{"title":"thetitle","description":"thedescription"}';
      l_response VARCHAR2(30000);
    BEGIN
      post( p_url => l_url, p_message =>l_json, p_response => l_response);
    END;which resulted in :
    status code: 500
    reason phrase: Internal Server Error
    Listener's log:
    Request Path passes syntax validation
    Mapping request to database pool: PoolMap [_poolName=apex, _regex=null, _workspaceIdentifier=WSDEMO, _failed=false, _lastUpdate=1364313600000, _template=/wsdemo/, _type=BASE_PATH]
    Applied database connection info
    Attempting to process with PL/SQL Gateway
    Not processed as PL/SQL Gateway request
    Attempting to process as a RESTful Service
    demo/test matches: demo/test score: 0
    Choosing: oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplateDispatcher as current candidate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=2648625079503782|2797815111031405, uriTemplate=demo/test], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logonConfig=LogonConfig [logonForm=null, logonFailed=null]], originsAllowed=[], corsEnabled=true]
    Determining if request can be dispatched as a Tenanted RESTful Service
    Request path has one path segment, continuing processing
    Tenant Principal already established, cannot dispatch
    Chose oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplateDispatcher as the final candidate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=2648625079503782|2797815111031405, uriTemplate=demo/test], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logonConfig=LogonConfig [logonForm=null, logonFailed=null]], originsAllowed=[], corsEnabled=true] for: POST demo/test
    demo/test is a public resource
    Using generator: oracle.dbtools.rt.plsql.AnonymousBlockGenerator
    Performing JDBC request as: SCOTT
    Mar 28, 2013 1:29:28 PM oracle.dbtools.common.jdbc.JDBCCallImpl execute
    INFO: Error occurred during execution of: [CALL, begin
    insert into scott.json_demo values(/*in:title*/?,/*in:description*/?);
    end;, [title, in, class oracle.dbtools.common.stmt.UnknownParameterType], [description, in, class oracle.dbtools.common.stmt.UnknownParameterType]]with values: [thetitle, thedescription]
    Mar 28, 2013 1:29:28 PM oracle.dbtools.common.jdbc.JDBCCallImpl execute
    INFO: ORA-06550: line 1, column 6:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare exit for goto if loop mod null pragma
       raise return select update while with <an identifier>
       <a double-quoted delimited-identifier> <a bind variable> <<
       close current delete fetch lock insert open rollback
       savepoint set sql execute commit forall merge pipe
    The symbol "" was ignored.
    ORA-06550: line 2, column 74:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare end exception exit for goto if loop mod
       null pragma raise return select update while with
       <an identifier> <a double-quoted delimited-id
    java.sql.SQLException: ORA-06550: line 1, column 6:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare exit for goto if loop mod null pragma
       raise return select update while with <an identifier>
       <a double-quoted delimited-identifier> <a bind variable> <<
       close current delete fetch lock insert open rollback
       savepoint set sql execute commit forall merge pipe
    The symbol "" was ignored.
    ORA-06550: line 2, column 74:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare end exception exit for goto if loop mod
       null pragma raise return select update while with
       <an identifier> <a double-quoted delimited-id
            at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
            at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
            at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
            at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:505)
            at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:223)
            at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
            at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:205)
            at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1043)
            at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336)
            at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3612)
            at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3713)
            at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4755)
            at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1378)
            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:597)
            at oracle.ucp.jdbc.proxy.StatementProxyFactory.invoke(StatementProxyFactory.java:242)
            at oracle.ucp.jdbc.proxy.PreparedStatementProxyFactory.invoke(PreparedStatementProxyFactory.java:124)
            at oracle.ucp.jdbc.proxy.CallableStatementProxyFactory.invoke(CallableStatementProxyFactory.java:101)
            at $Proxy46.execute(Unknown Source)
            at oracle.dbtools.common.jdbc.JDBCCallImpl.execute(JDBCCallImpl.java:44)
            at oracle.dbtools.rt.plsql.AnonymousBlockGenerator.generate(AnonymousBlockGenerator.java:176)
            at oracle.dbtools.rt.resource.templates.v2.ResourceTemplatesDispatcher$HttpResourceGenerator.response(ResourceTemplatesDispatcher.java:309)
            at oracle.dbtools.rt.web.RequestDispatchers.dispatch(RequestDispatchers.java:88)
            at oracle.dbtools.rt.web.HttpEndpointBase.restfulServices(HttpEndpointBase.java:412)
            at oracle.dbtools.rt.web.HttpEndpointBase.service(HttpEndpointBase.java:162)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
            at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.doFilter(ServletAdapter.java:1059)
            at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.invokeFilterChain(ServletAdapter.java:999)
            at com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:434)
            at oracle.dbtools.standalone.SecureServletAdapter.doService(SecureServletAdapter.java:65)
            at com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:379)
            at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
            at com.sun.grizzly.tcp.http11.GrizzlyAdapterChain.service(GrizzlyAdapterChain.java:196)
            at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
            at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
            at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
            at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
            at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
            at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
            at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
            at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
            at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
            at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
            at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
            at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
            at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
            at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
            at java.lang.Thread.run(Thread.java:662)
    Error during evaluation of resource template: ORA-06550: line 1, column 6:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare exit for goto if loop mod null pragma
       raise return select update while with <an identifier>
       <a double-quoted delimited-identifier> <a bind variable> <<
       close current delete fetch lock insert open rollback
       savepoint set sql execute commit forall merge pipe
    The symbol "" was ignored.
    ORA-06550: line 2, column 74:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare end exception exit for goto if loop mod
       null pragma raise return select update while with
       <an identifier> <a double-quoted delimited-idPlease advise.
    Regards
    Zack

    Zack.L wrote:
    Hi Andy,
    Sorry, forgot to post the Source that's use by both AL1.1.4 and AL2.0.1.
    Source
    begin
    insert into scott.json_demo values(:title,:description);
    end;
    it's failing during the insert?
    Yes, it failed during insert using AL2.0.1.
    So the above statement produces the following error message:
    The symbol "" was ignored.
    ORA-06550: line 2, column 74:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
    begin case declare end exception exit for goto if loop mod
    null pragma raise return select update while with
    <an identifier> <a double-quoted delimited-idThis suggests to me that an unprintable character (notice how there is nothing between the double quotes - "") has worked its way into your PL/SQL Handler. Note how the error is reported to be a column 74 on line 2, yet line 2 of the above block should only have 58 characters, so at a pure guess somehow there's extra whitespace on line 2, that is confusing the PL/SQL compiler, I suggest re-typing the PL/SQL handler manually and seeing if that cures the problem.

  • Insert data using peoplesoft webservice gives component API error

    Hi,
    I am using jdeveloper 11g to consume a peoplesoft webservice using the wsdl file and JAX-Ws approach to build the proxy.
    I have been successfull in getting to work the "get", "find" methods for the webservice but while trying to access the create/Update(inserting data) method, it gives me the following exception.
    In CREATE method
    Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Component Interface API.
         at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:197)
         at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:130)
         at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:125)
         at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:95)
         at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:135)
         at $Proxy32.createCompIntfcKCMWEBCASECI(Unknown Source)
         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:597)
         at weblogic.wsee.jaxws.spi.ClientInstance$ClientInstanceInvocationHandler.invoke(ClientInstance.java:363)
         at $Proxy33.createCompIntfcKCMWEBCASECI(Unknown Source)
         at project1.proxy.KCM_WEB_CASE_CISoapClient.createKCMMethod(KCM_WEB_CASE_CISoapClient.java:318)
         at project1.proxy.KCM_WEB_CASE_CISoapClient.main(KCM_WEB_CASE_CISoapClient.java:116)
    Process exited with exit code 1.
    From the exception it is not clear what is missing or where am i going wrong. I have provided all the mandatory values required by the method.
    The create method generated needs almost 40 parameters, hence i am intializing all of them and sending it.
    Few parameters are INOUT or out mode, depending on that i even created the required holder etc.
    I dont have any access to peoplesoft logs, is there a way to debug this further.
    Basically i am stuck here as i am not able to decode this exception.
    Can anyone tell me where is it failing, is it a some formation error or is it creating a query at db and getting a sql error??
    as mentioned earlier, its very difficult to get access to db resources hence its becmong very difficult to debug the error.
    Any help will be appreciated.
    Thank you in advance
    Ashvini
    Edited by: [email protected] on Jun 7, 2010 7:49 AM
    Edited by: [email protected] on Jun 8, 2010 6:37 AM

    Hi, I have exact the same problem. Have you got any answer for this problem yet? Please forward it to me if you have one. Many thanks.

  • Insert Date Using Text Field

    Hi,
    i have date item ,Can i insert date from text field in dd/mm/yy format.
    My Column for date is DATE type in table.
    How can i ido this with Text field .
    Thanks

    I think you want to have text field for user to input the date? (instead of date picker item type)
    If you are using custom PL/SQL code, it is fine, because you just use to_date(:Px_DATE_ITEM, 'dd/mm/yyyy'); or whatever format you are expecting, in your insert statement.
    If it is a DML process type, I don't think it's possible - apex probably converts the text from the data picker into a date datatype at run time, but not sure it'd do it when its just a text box.
    Ta,
    Trent
    Edited by: trent on Jan 28, 2011 10:57 PM
    I take that back. So long as you have specified the application date format in the globalization attributes, and the format in the text box is the same/valid (otherwise it must be in the format as specified in NLS_DATE_FORMAT), it will insert no trouble in a DML process. http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/bldr.htm#CHDBHCBB

  • Problem in Creating new row & inserting data using CreateInsert and Commit

    Hello All,
    I have created a page there are few input text and i want to insert the data into a database table. I have created an Application Module I am using CreateInsert and Commit operation but there is one problem.
    At first it created a row in database after that it is not creating the new row instead it is updating the same row with the new values.
    In bindings of my jspx page I have created two binding for action (1) CreateInsert for the VO of that Application Module (2) Commit operation of that Application Module.
    Here is the code snippet of my application:
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("CreateInsert");
    Object result = operationBinding.execute();
    *if (!operationBinding.getErrors().isEmpty()) {*
    return null;
    OperationBinding operationBinding1 = bindings.getOperationBinding("Commit");
    Object result1 = operationBinding1.execute();
    *if (!operationBinding1.getErrors().isEmpty()) {*
    return null;
    I have tried using Execute+Commit and Insert+Commit case also in every case it is updating the same row and not inserting a new row.
    Is there anything I am missing?
    Please Help.

    hi user,
    i dono. why are trying with codes. adf provides zero lines codes.
    a wonderful drag and drop functionality provide by the framework.
    while double click the button the codes are  registered in your bean
        public String cb6_action() {
            BindingContainer bindings = getBindings();
            OperationBinding operationBinding = bindings.getOperationBinding("CreateInsert");
            Object result = operationBinding.execute();
            if (!operationBinding.getErrors().isEmpty()) {
                return null;
            return null;
        public String cb8_action() {
            BindingContainer bindings = getBindings();
            OperationBinding operationBinding = bindings.getOperationBinding("Commit");
            Object result = operationBinding.execute();
            if (!operationBinding.getErrors().isEmpty()) {
                return null;
            return null;
        public String cb7_action() {
            BindingContainer bindings = getBindings();
            OperationBinding operationBinding = bindings.getOperationBinding("Delete");
            Object result = operationBinding.execute();
            if (!operationBinding.getErrors().isEmpty()) {
                return null;
            return null;
        public String cb14_action() {
            BindingContainer bindings = getBindings();
            OperationBinding operationBinding =
                bindings.getOperationBinding("Delete4");   // some different here. after deleting usually do commit
            OperationBinding operationBinding1 =  
                bindings.getOperationBinding("Commit");    // so here commit operation.
            Object result = operationBinding.execute();
            Object result1 = operationBinding1.execute();
            if (!operationBinding.getErrors().isEmpty()) {
                return null;
            if (!operationBinding1.getErrors().isEmpty()) {
                //add error handling here
                return null;
            return null;
        }if am not understud correctly. please some more explanation need.

  • Inserting data using stored procedure

    Using SQL Server Express 2014, I'm creating a stored procedure to accept parameters and convert data from a staging table to a production table. The parameters specify the table names and a field to lookup in another table. This is the first stored procedure
    I've tried to create by myself though and I'm basing it on a guide. Here's what I've got so far:
    CREATE PROCEDURE [dbo].[stp_UpdateAggregatePerf]
    @prod_tbl NVARCHAR(250), @stg_tbl NVARCHAR(250), @customer NVARCHAR(20)
    AS
    BEGIN
    DECLARE @p NVARCHAR(250), @s NVARCHAR(250), @c NVARCHAR(20), @cid int, @sql NVARCHAR(MAX)
    SET @p = @prod_tbl
    SET @s = @stg_tbl
    SET @c = @customer
    SET @cid = 'SELECT [dbo].[Customers].[CustomerID]
    FROM dbo.customers
    WHERE [dbo].[Customers].[CustomerName] LIKE ' + @c
    SET @sql = 'INSERT INTO ' + @prod_tbl + '
    SELECT CONVERT (datetime,TimeIndex,103) AS TimeIndex,
    CONVERT(decimal(10,3),user_reads,3) AS Reads,
    CONVERT(decimal(10,3), user_writes,3) AS Writes,
    CONVERT(decimal,10,3),total_transfers,3) AS Total,
    CONVERT(decimal(10,3),cp_reads,3) AS CPReads,
    SUBSTRING(AggregateName,1,25),
    SUBSTRING(ControllerName,1,25),
    SUBSTRING(@cid,1,25)
    FROM' + @stg_tbl
    EXEC sp_executesql @sql
    SET @sql = 'DROP TABLE' + @stg_tbl
    EXEC sp_executesql @sql
    END
    So it should accept the parameters, take the customer name parameter and look up the customer ID field from another table to use in the last column, then generate and run the INSERT INTO statement to convert and transfer data, then drop the staging table.
    I'm not sure how to go about using the INSERT statement with variables though, or even if I'm concatenating the string together correctly.
    Here's my CREATE statements for the tables:
    prod table:
    CREATE TABLE [dbo].[AggregatePerf](
    [AggrPerfID] [int] IDENTITY(1,1) NOT NULL,
    [AggregateName] [varchar](25) NOT NULL,
    [TimeIndex] [datetime] NOT NULL,
    [Reads] [decimal](10, 3) NOT NULL,
    [Writes] [decimal](10, 3) NOT NULL,
    [Total] [decimal](10, 3) NOT NULL,
    [CPReads] [decimal](10, 3) NOT NULL,
    [ControllerName] [varchar](25) NOT NULL,
    [CustomerID] [varchar](10) NOT NULL,
    CONSTRAINT [PK_AggregatePerf] PRIMARY KEY CLUSTERED
    [AggrPerfID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    Staging:
    CREATE TABLE [dbo].[$tablename] (
    [TimeIndex] VARCHAR(100)
    , [user_reads] VARCHAR(100)
    , [user_writes] VARCHAR(100)
    , [cp_reads] VARCHAR(100)
    , [total_transfers] VARCHAR(100)
    , [AggregateName] VARCHAR(100)
    , [ControllerName] VARCHAR(100)
    The staging table is generated from PowerShell to import CSVs but I'm past that stage of the project now. I hope you can help  me get an understanding here as once I wrap my around one table I can apply the same technique to others.
    Thanks in advance
    Adam

    Why do you provide a tables as a parameters? I think you may avoid using dynamic sql and simple use a static one.
    Where do you use @cid
    variable?
    Static SQL may look like
    SELECT @cid=
    [dbo].[Customers].[CustomerID]
    FROM dbo.customers
    WHERE [dbo].[Customers].[CustomerName] LIKE '%'+@c+'%'
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Problem  inserting date using the date function

    Hi there,
    I am getting this error The value
    "#CREATEODBCDATE(StartDate)#" could not be converted to a date. I
    used different methods including the Now() function but getting
    always the converted to a date error. The database fields are set
    to datetime format with length of 8 bits. The database is sql
    server database and the date format I use is
    =dateformat(now(),"mm-dd-yyyy")&timeformat(now(),"hh:mm:ss ".
    The actual time format the datbase us is the same format except
    there is AM or PM after the time, is this one of the reasons?
    Thanks for your help.

    In my SQL Server inserts I insert a date like the the NOW()
    function
    as
    insert into table (col1, date1) values ('texthere', GETDATE()
    your issue may be that the insert, update, or delete needs to
    be an SQL
    command, not
    a coldfusion one Coldfusion's now() --> SQL Server's
    getdate()
    For Updates or deletes, where I want to match a date, I let
    CF do a bit of
    the work inside the
    sql statement....
    update table set datefield = <cfqueryparam
    cfsqltype="cf_sql_date"
    value='#meetdate#'>
    (where '#meetdate#' is the form date or date that I want to
    update. CF then
    verifies it is a proper date structure before attemptint to
    save to the SQL
    SErver datetime field :)
    HTH,
    DixieGAl
    (although I
    "hannash" <[email protected]> wrote in message
    news:e98p4j$brc$[email protected]..
    | Hi there,
    |
    | I am getting this error The value
    "#CREATEODBCDATE(StartDate)#" could not
    be
    | converted to a date. I used different methods including the
    Now()
    function but
    | getting always the converted to a date error. The database
    fields are set
    to
    | datetime format with length of 8 bits. The database is sql
    server database
    and
    | the date format I use is
    |
    =dateformat(now(),"mm-dd-yyyy")&timeformat(now(),"hh:mm:ss ".
    The actual
    time
    | format the datbase us is the same format except there is AM
    or PM after
    the
    | time, is this one of the reasons?
    |
    | Thanks for your help.
    |

  • How to insert data using xsql

    I want to insert a XML Document using xsql?
    tell me anyone step step procedure using xsql;this is very urgent

    I want to insert a XML Document using xsql?
    tell me anyone step step procedure using xsql;this is very urgent Use use <xsql:insert-request> to insert your data into the database.
    example
    <xsql:insert-request xmlns:xsql="urn:oracle-xsql" connection="demo" table="TC_UTIL_CONFIG" columns="ID, NAME, VALUE" />
    The above inserts the input request to the table and inserts the colums with the values. The input XML should look like the following
    <ROWSET>
    <ROW>
    <ID>1</ID>
    <NAME>kesav</NAME>
    <VALUE>good</VALUE>
    <ROW>
    <ROW>
    <ID>2</ID>
    <NAME>kumar</NAME>
    <VALUE>good</VALUE>
    </ROW>
    </ROWSET>
    If your request doesn't match the above you can use transform attribute to specify an xsl to convert the input to match the above xml.
    If you submit your request from form you should use the transform stylesheet to convert the request to the XML. If you use Microsoft.XMLHTTP to post the xml document which matches the xml then you don not need any transformation.

  • Insert data using row selector

    Hi :
    In my applicaion i need to insert only the selected data ie row
    the query i am using is
    select
    html_db_item.text(1,pobj.name,20,25) "object Name",
    html_db_item.text(1,null,20,25) "Incomming Hours ",
    html_db_item.text(1,null,20,25) "Design Hours "
    from projects pro.
    project_objects pobj
    where pro.id = pobj.pro_id and
    pro.id = :p10_projects
    here p10_projects is the project where for each project there would be 10 to 100 objects ie pobj.name
    here i need to insert these object names and hours into anothere table where i need a row selector to select only selected objects and insert please suggest me
    so as i select the rows only that need to be inserted
    Thanks
    Sudhir

    Randy :
    please try this query
    SELECT
    HTMLDB_ITEM.DISPLAY_AND_SAVE(2,NULL) "Project Objects",
    HTMLDB_ITEM.DATE_POPUP(3,rownum,null,'dd-mon-yyyy',12,15) "date"
    FROM
    DUAL
    UNION
    SELECT
    HTMLDB_ITEM.DISPLAY_AND_SAVE(2,SYSDATE) "Project Objects",
    HTMLDB_ITEM.DATE_POPUP(3,rownum,null,'dd-mon-yyyy',12,15) "date"
    FROM
    DUAL
    first change the query to sql updatable form and then add row selector to this report and try to select the 2nd row date picker ull find the problem wht i am facing
    i need row selector becouse to select the date indivisually and insert them
    please give me some soloution
    thanks
    sudhir

  • Accessing Password Keeper Data using Desktop Software

    I recently had a pressure crack to the LCD on my Curve 8310.
    I need to access my stored passwords in Password Keeper, however since the LCD is toast, can't read anything on the phone.
    I'm waiting on a replacement LCD, but need Password, ASAP.
    Is there any programs to view the program on the pc?
    Solved!
    Go to Solution.

    I tried a solution which did actuall work, so I figured I would post in case anyone else has this same problem.
    I had previously backed up the data from my Blackberry Curve 8310 using the Desktop Management Software.
    I downloaded a Simulatr for my Curve 8310 and installed the software.  I found the simulator at BlackBerry Smartphone Simulators - URL
    http://na.blackberry.com/eng/developers/resources/simulators.jsp
    Once the program was installed I ran the program, which brings up an image of the phone.
    I started my Desktop Management Software.
    Now back in the Smartphone Simulator
    In the menu, I selected "USB Cable Connected" which simulates connecting the smartphone.
    Once I did this, the Desktop Management Software prompted me to create settings for then new phone.
    Once I set up this new Virtual Phone, I Restored my backup from the Desktop Management Software to the New Virtual Phone.
    I could then use the mouse to go to the Password Keeper and open the program.  It prompted me for my password and all of the data appeared.
    Hope this helps someone else.  Good Luck.
    Mark

  • Error while inserting data using DBMS_RANDOM

    Hi ,
    I tried the following insert command in the link http://www.oracle-base.com/articles/misc/RollupCubeGroupingFunctionsAndGroupingSets.php
    BANNER
    Oracle Database 10g Release 10.2.0.1.0 - Production
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    SQL> INSERT INTO dimension_tab
      2  SELECT TRUNC(DBMS_RANDOM.value(low => 1, high => 3)) AS fact_1_id,
      3         TRUNC(DBMS_RANDOM.value(low => 1, high => 6)) AS fact_2_id,
      4         TRUNC(DBMS_RANDOM.value(low => 1, high => 11)) AS fact_3_id,
      5         TRUNC(DBMS_RANDOM.value(low => 1, high => 11)) AS fact_4_id,
      6         ROUND(DBMS_RANDOM.value(low => 1, high => 100), 2) AS sales_value
      7  FROM   dual
      8  CONNECT BY level <= 1000;
    SELECT TRUNC(DBMS_RANDOM.value(low => 1, high => 3)) AS fact_1_id,
    ERROR at line 2:
    ORA-00907: missing right parenthesisCould you please advice me to get the correct records

    smile wrote:
    Hi ,
    I tried the following insert command in the link http://www.oracle-base.com/articles/misc/RollupCubeGroupingFunctionsAndGroupingSets.php
    BANNER
    Oracle Database 10g Release 10.2.0.1.0 - Production
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    SQL> INSERT INTO dimension_tab
    2  SELECT TRUNC(DBMS_RANDOM.value(low => 1, high => 3)) AS fact_1_id,
    3         TRUNC(DBMS_RANDOM.value(low => 1, high => 6)) AS fact_2_id,
    4         TRUNC(DBMS_RANDOM.value(low => 1, high => 11)) AS fact_3_id,
    5         TRUNC(DBMS_RANDOM.value(low => 1, high => 11)) AS fact_4_id,
    6         ROUND(DBMS_RANDOM.value(low => 1, high => 100), 2) AS sales_value
    7  FROM   dual
    8  CONNECT BY level <= 1000;
    SELECT TRUNC(DBMS_RANDOM.value(low => 1, high => 3)) AS fact_1_id,
    ERROR at line 2:
    ORA-00907: missing right parenthesisCould you please advice me to get the correct recordsYou can't used named parameters for function/procedure calls in SQL until version 11.
    You'll have to remove the
    low => And stick with the good old "positional" way of doing things.

  • Help needed in inserting data using a query

    I need to have some data as a result of the following query:
    select sched_num,load_id,ord_id,split_id from ord_load_seq
    where (ord_id,split_id,sched_num) in (select ord_id,split_id,sched_num from ord_load_seq where seq_num = '2'
    group by ord_id,split_id,sched_num having count(1) >1)
    order by ord_id,split_id,sched_num;
    But currently it retunrns no rows. The problem is in the having count(1)> 1 clause.
    When i make =1, it returns rows. But no rows on > 1. I even tried inserting some rows to get the result >1
    But still the query on a whole returns no rows.Please help.

    ohhh... lets start our lesson children:
    here is code to consider:
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.2.0
    SQL>
    SQL> --Q1
    SQL> with tbl as
      2  (select 1 fld1, 1 fld2, 1 fld3 from dual
      3  union all
      4  select 1 fld1, 1 fld2, 2 fld3 from dual
      5  union all
      6  select 1 fld1, 1 fld2, 3 fld3 from dual
      7  union all
      8  select 1 fld1, 2 fld2, 3 fld3 from dual
      9  union all
    10  select 1 fld1, 3 fld2, 3 fld3 from dual)
    11  select  fld1, fld2, fld3 from tbl
    12  order by fld1, fld2, fld3
    13  /
          FLD1       FLD2       FLD3
             1          1          1
             1          1          2
             1          1          3
             1          2          3
             1          3          3
    SQL> --Q2
    SQL> with tbl as
      2  (select 1 fld1, 1 fld2, 1 fld3 from dual
      3  union all
      4  select 1 fld1, 1 fld2, 2 fld3 from dual
      5  union all
      6  select 1 fld1, 1 fld2, 3 fld3 from dual
      7  union all
      8  select 1 fld1, 2 fld2, 3 fld3 from dual
      9  union all
    10  select 1 fld1, 3 fld2, 3 fld3 from dual)
    11  select  fld1, fld2, fld3, count(1) from tbl
    12  group by fld1,fld2,fld3
    13  order by fld1, fld2, fld3
    14  /
          FLD1       FLD2       FLD3   COUNT(1)
             1          1          1          1
             1          1          2          1
             1          1          3          1
             1          2          3          1
             1          3          3          1
    SQL> --Q3
    SQL> with tbl as
      2  (select 1 fld1, 1 fld2, 1 fld3 from dual
      3  union all
      4  select 1 fld1, 1 fld2, 2 fld3 from dual
      5  union all
      6  select 1 fld1, 1 fld2, 3 fld3 from dual
      7  union all
      8  select 1 fld1, 2 fld2, 3 fld3 from dual
      9  union all
    10  select 1 fld1, 3 fld2, 3 fld3 from dual)
    11  select  fld1, fld2, fld3 from tbl
    12  group by fld1,fld2,fld3
    13  having count(1) > 1
    14  order by fld1, fld2, fld3
    15  /
          FLD1       FLD2       FLD3
    SQL> --Q4
    SQL> with tbl as
      2  (select 1 fld1, 1 fld2, 1 fld3 from dual
      3  union all
      4  select 1 fld1, 1 fld2, 2 fld3 from dual
      5  union all
      6  select 1 fld1, 1 fld2, 2 fld3 from dual
      7  union all
      8  select 1 fld1, 1 fld2, 3 fld3 from dual
      9  union all
    10  select 1 fld1, 2 fld2, 3 fld3 from dual
    11  union all
    12  select 1 fld1, 3 fld2, 3 fld3 from dual)
    13  select  fld1, fld2, fld3 from tbl
    14  order by fld1, fld2, fld3
    15  /
          FLD1       FLD2       FLD3
             1          1          1
             1          1          2
             1          1          2
             1          1          3
             1          2          3
             1          3          3
    6 rows selected
    SQL> --Q5
    SQL> with tbl as
      2  (select 1 fld1, 1 fld2, 1 fld3 from dual
      3  union all
      4  select 1 fld1, 1 fld2, 2 fld3 from dual
      5  union all
      6  select 1 fld1, 1 fld2, 2 fld3 from dual -- inserted duplicate row
      7  union all
      8  select 1 fld1, 1 fld2, 3 fld3 from dual
      9  union all
    10  select 1 fld1, 2 fld2, 3 fld3 from dual
    11  union all
    12  select 1 fld1, 3 fld2, 3 fld3 from dual)
    13  select  fld1, fld2, fld3, count(1)   from tbl
    14  group by fld1,fld2,fld3
    15  order by fld1, fld2, fld3
    16  /
          FLD1       FLD2       FLD3   COUNT(1)
             1          1          1          1
             1          1          2          2
             1          1          3          1
             1          2          3          1
             1          3          3          1
    SQL> --Q6
    SQL> with tbl as
      2  (select 1 fld1, 1 fld2, 1 fld3 from dual
      3  union all
      4  select 1 fld1, 1 fld2, 2 fld3 from dual
      5  union all
      6  select 1 fld1, 1 fld2, 2 fld3 from dual -- inserted duplicate row
      7  union all
      8  select 1 fld1, 1 fld2, 3 fld3 from dual
      9  union all
    10  select 1 fld1, 2 fld2, 3 fld3 from dual
    11  union all
    12  select 1 fld1, 3 fld2, 3 fld3 from dual)
    13  select  fld1, fld2, fld3 from tbl
    14  group by fld1,fld2,fld3
    15  having count(1) > 1
    16  order by fld1, fld2, fld3
    17  /
          FLD1       FLD2       FLD3
             1          1          2
    SQL> Q1. As you may see we have an bunch of data where each row is unique combination of the columns value.
    Q2. lets try to group it by fld1 and fld2 and fld3 columns. We don't expect any miracle and got the same data as Q1. Why? Because each row is unique combination(group) in scope of fld1, fld2, fld3 - count(1) exactly shows us that.
    Q3. Q2 is explanation why we got no rows filter (having count(1) > 1)because the result of the clause is always false.
    Q4. Lets put some duplication.
    Q5. Now we got some new result. Count shows us group with more then one rows.
    Q6. Shows us exact group which we've found in Q5.

  • How to insert data using jdeveloper 11g

    hi all..
    i'm starting my first web aplication using JSF in jdeveloper 11g.
    I have one table in the database has two attributes(id and name). i connected to the database succrssfuly.
    i built adf application and created JSF page then i draged my view from data controls to built adf form without selected submit button.
    and i draged commit operation and created a button to save .
    but when i run the application the adding process didn't work.
    plz, help me to complete my application .
    thanks

    well Learn ADF first :)
    check this simple Create Edit form http://orclsamples.googlecode.com/files/CreateEditRecord.zip might help you to get started
    also check my blog i post basic cook book kind style ADF examples for newbies http://baigsorcl.blogspot.com/search/label/ADF

  • Inserting dates using TO_DATE and getDateTime with preparedStatement

    Hi
    I have this code here but its giving error msg, *"Cannot find symbol" Symbol: method TO_DATE(...)* . Can someone point to me what is wrong??
    public static void pstmtQry(Connection con) {
    try{
      queryTable1 =" INSERT INTO Table1 "
                        + "(DATE, ID) "
                        + " VALUES (?, ?)";
      pstmtTable1 = con.prepareStatement(queryTable1);
    catch.......{
    method1() {
    try {
                pstmtTable1.setString(1,*TO_DATE*(getDateTime("dd/MM/yyyy"), "DD/MM/YYYY"));
                pstmtTable1.setString(2,ID);
    RS = pstmtTable1.executeQuery();Thanks
    Edited by: okun on Jun 9, 2010 9:02 PM
    Edited by: okun on Jun 9, 2010 9:03 PM

    Below is the query i would like to change to a preparedStatement:
    query = " INSERT INTO Table1 "
                       + "(DATE, ID) "
                     + " VALUES ( TO_DATE('"
                      + getDateTime("dd/MM/yyyy") + "','DD/MM/YYYY') "', '"
                       + ID + "')";{code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for

  • Using more than one query to calculate a field

    Im trying to calculate a third field through 2 results of 2 queries without success. The problem simplified is the following. Suppose that query1 returns the value 10 per line and query2 return 20 per line. Then I have the lines: 10 20 10 20 10 20 To

  • Pricing error  VF073

    Hello, iam facing an issue while creating an  inter company invoice. in one of the line items in invoice, the  qty is set to zero and the system is giving a message "pricing error VF073" the delivery and sales order qty all is same for that particlua

  • Booting OVM server from multipath SAN

    Hi, I read in the release notes of OVM 3.0.3 that "booting from multipath SAN is not supported". I have a limitation that forces me to use SAN boot. What is the best practise? 1. Go for local disks for OVM server or 2. Is there a workaround which wil

  • After i recovered my iPhone, it doesn't ask for backup, it just goes back to recovery mode. How do I fix this?

    I turned off my iPhone and when i turned it back on, it went into recovery mode. When it went to recovery mode i restored it but it didnt ask me to choose backup when it finished, instead it just went back into recovery mode. I've restored it about f

  • Canvas has gone green and displays nothing...

    Hi, Im using Final Cut Studio 2. Everything was working ok and I was adding some text and now the canvas won't display anything its just green. New projects are fine its just this project. I really dont want to re-do this project as it has taken me a