Pl/SQl function to insert data

Here is what I am trying to do:
I want to create a simple stored function in database that inserts data into a temp table based on an input parameter received.
I want to create a workbook in discoverer to execute this function. When i create a calculation based on this function and run the report, its throws an error saying "ORA-14551 : Cannot perform a DML operation inside a query"
My objective is to insert data into a temporary table before executing a report to get data from the temp table.
Any solution/suggestions are most welcome?

Hi,
Use
CREATE FUNCTION ...
IS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
If you just want to set some variables to use within the SQL of a report you may be better using contexts, see Re: Passing multiple parameters into Custom Folder...
Hope that helps,
Rod West

Similar Messages

  • PL/SQL procedure to insert data doesn't work and unable to find reason.

    Sorry that I couldn't find the best place to post this question. It seems that the forum does not deal with this kind of question. I post here for help.
    I have a stored procedure to insert data into one table. SP was compiled without error and executed without error (from log table to get information). But the data was not inserted into
    the target table. I have tried different way to figure out the reason. But I failed to get any idea. Please help me to find possible reasons. The smple SP looks like this:
    CREATE OR REPLACE PROCEDURE my.sp_insert( P_DATE IN VARCHAR2)
    IS
    declare section
    begin
    insert into target_table (column1, column2, column3, column4)
    select record1, record2, record3, record4 from table1, table2, table3, table4
    where clause;
    commit;
    exception section
    UPDATE PROCESS_LOG_TABLE CLAUSE;
    html_email section;
    rollback;
    end my.sp_insert
    I have tested that "select record1, record2, record3, record4 from table1, table2, table3, table4" really fetch the 7,000 records. and if I only run part of SQL from SQLPLUS as
    insert into target_table (column1, column2, column3, column4)
    select record1, record2, record3, record4 from table1, table2, table3, table4
    where clause;
    It will work and insert 7,000 records into target table. Why did it not insert into target_table when execiting as stored procedure? Please help with your input. Thanks.
    Edited by: citicbj on Feb 12, 2013 4:15 PM

    Dear Friend,
    Is the user from which you created database procedure and sqlplus that you tested the code successfully is same?
    Regards
    Ahamed Rafeeque Cherkala

  • How we use group by function while inserting data through datablock

    Hi All
    i have datablock in tabulor form
    i want when i insert data (commit) then data will insert in group by
    example
    my table is like that
    desc table
    dress_name     color             qty
    and i am inserting data into it like this
    dress_name    color     qty
    nice_dress      BLK       1
    nice_dress      BLK       1
    nice_dress      BLK       1
    vik_dress        GRY      1
    vik_dress        GRY      1
    vik_dress        GRY      1
    i want when i retrive the data it will like this
    dress_name    color     qty
    nice_dress      BLK       3
    vik_dress        GRY      3Thanks and Regards
    Vikas Singhal
    Edited by: vikas singhal on Feb 14, 2011 4:05 PM

    Hi vikas singhal
    before insert i need to group it is possible or notPls note : Whenever you do a "group by" or "order by" operation, Oracle will invoke a sorting operation. Using the "group by" inside SQL syntax is also useful for doing summaries
    i want when i retrive the data it will like this Pls try the following...
    SQL> select
      2    dress_name,
      3    color ,
      4    qty,
      5    count(quantity) Num , sum(quantity)summation  -- may be the same
      6   from
      8    ur_table_name
      9  group by dress_name   ,  color  ,   qty ;u can also try Francois's Suggestion by creating a view based on the last Query...
    want when i insert data (commit) then data will insert in group by
    make the view to be insert from it as follow...
    http://www.java2s.com/Tutorial/Oracle/0160__View/PerforminganINSERTUsingaView.htm
    Hope this helps...
    Regards,
    Abdetu...

  • Using SQL Loader to insert data based on conditionally statements

    I would like to use sql loader to insert records from a single text file into an Oracle database table. Sounds easy but the problem is that I need to check the existence of data in another table (Table A) before data can be loaded into Table B.
    Table A has two columns: dept_no (primary key value) and dept_name (char)
    Table B has five columns: emp_no (primary key value), dept_no (foreign key value to Table A), employee (char), job_title (char) and salary (number)
    Text File looks like this:
    Finance Jones President 10000
    HR Smith Admin 2000
    HelpDesk Jenkins Technician 3000
    Problem:
    1. I need sql loader to insert records into Table B by first checking if the first field in the file is in Table A.
    2. If value exists get it's dept_no value.
    3. If value doesn't exist discard record ( I might want to have sql loader insert a new record for this into Table A)
    4. Using value from #2, insert the value in Table B for dept_no column.
    5. Also assign a sequence value for the emp_no value in Table B.
    Any guidance is greatly appreciated.
    Thanks,

    Hello,
    I am not sure this is possible with SQL loader. I would rather use an external table based on your file.
    Then, I would use SQL to load your data into your table, based on your conditions.
    Your request is not very complicated, writing the SQL to do that will be really more simple than trying to do it with SQL loader.
    Hope it will help.
    Regards,
    Sylvie

  • SQL*Loader to insert data file name during load

    I'd like to use a single control file to load data from different files (at different times) to the same table. I'd like this table to have a column to hold the name of the file the data came from. Is there a way for SQL*Loader to automatically do this? (I.e., as opposed to running an update query separately.) I can edit the control file before each load to set a CONSTANT to hold the new data file name, but I'd like it to pick this up automatically.
    Thanks for any help.
    -- Harvey

    Hello Harvey.
    I've previously attempted to store a value into a global/local OS variable and use this within a SQL*Loader control file (Unix OS and Oracle versions between 7.3.4 and 10g). I was unsuccessful in each attempt and approach I could imagine. It was very easy to use a sed script to make a copy of the control file, changing a string within it to do this however.
    Do you really want to store a file name on each and every record? Perhaps an alternative would be to use a relational model. Create a file upload log table that would store the file name and an upload # and then have the SQL*Loader control file call a function that would read that table for the most recent upload #. You'll save some disk space too.
    Hope this helps,
    Luke

  • Invoking a PL/SQL function from BPEL throws fault.

    Hi, I'm trying to invoke a PL/SQL function that inserts data in to a table from a BPEL via DB Adapter. The process, when I test it, throws a runtime fault as follows:
    *Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'EmpRegister' failed due to: JCA Binding Component connection issue. JCA Binding Component is unable to create an outbound JCA (CCI) connection. AddEmployee:EmpRegister [ EmpRegister_ptt::EmpRegister(InputParameters,OutputParameters) ] : The JCA Binding Component was unable to establish an outbound JCA CCI connection due to the following issue: BINDING.JCA-12510 JCA Resource Adapter location error. Unable to locate the JCA Resource Adapter via .jca binding file element <connection-factory/> The JCA Binding Component is unable to startup the Resource Adapter specified in the <connection-factory/> element: location='eis/DB/DBConn_215'. The reason for this is most likely that either 1) the Resource Adapters RAR file has not been deployed successfully to the WebLogic Application server or 2) the '<jndi-name>' element in weblogic-ra.xml has not been set to eis/DB/DBConn_215. In the last case you will have to add a new WebLogic JCA connection factory (deploy a RAR). Please correct this and then restart the Application Server ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.*
    Also, the fault description was a s follows:
    *JCA Resource Adapter location error. Unable to locate the JCA Resource Adapter via .jca binding file element <connection-factory/> The JCA Binding Component is unable to startup the Resource Adapter specified in the <connection-factory/> element: location='eis/DB/DBConn_215'. The reason for this is most likely that either 1) the Resource Adapters RAR file has not been deployed successfully to the WebLogic Application server or 2) the '<jndi-name>' element in weblogic-ra.xml has not been set to eis/DB/DBConn_215. In the last case you will have to add a new WebLogic JCA connection factory (deploy a RAR). Please correct this and then restart the Application Server.*
    I know, it looks like a JCA adapter error, but when I do a DB to DB table synchronization with this connection factory, no problems happen. Is ther any special procedure I should follow in mapping input data to db schema?

    HI,
    I am working on BPEL process and human workflow...
    I created a process and a Data control and now can see it as JCA Adapter in console..in this adapter I am executing a sql procedure.. we can execute in in BPEL process through invoke activity, now my requirement is how to invoke this data control through custom java code. please help...\
    now i have two wsdl files.
    RegistrationUpload.wsdl(process name)
    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions name="RegistrationUpload"
    targetNamespace="http://xmlns.oracle.com/RegistrationUpload_jws/RegistrationUpload/RegistrationUpload"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:client="http://xmlns.oracle.com/RegistrationUpload_jws/RegistrationUpload/RegistrationUpload"
    xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/">
         <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         TYPE DEFINITION - List of services participating in this BPEL process
         The default output of the BPEL designer uses strings as input and
         output to the BPEL Process. But you can define or import any XML
         Schema type and use them as part of the message types.
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
         <wsdl:types>
              <schema xmlns="http://www.w3.org/2001/XMLSchema">
                   <import namespace="http://xmlns.oracle.com/RegistrationUpload_jws/RegistrationUpload/RegistrationUpload" schemaLocation="xsd/RegistrationUpload.xsd" />
              </schema>
         </wsdl:types>
         <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         MESSAGE TYPE DEFINITION - Definition of the message types used as
         part of the port type defintions
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
         <wsdl:message name="RegistrationUploadRequestMessage">
              <wsdl:part name="payload" element="client:process"/>
         </wsdl:message>
         <wsdl:message name="RegistrationUploadResponseMessage">
              <wsdl:part name="payload" element="client:processResponse"/>
         </wsdl:message>
         <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         PORT TYPE DEFINITION - A port type groups a set of operations into
         a logical service unit.
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
         <!-- portType implemented by the RegistrationUpload BPEL process -->
         <wsdl:portType name="RegistrationUpload">
              <wsdl:operation name="process">
                   <wsdl:input message="client:RegistrationUploadRequestMessage"/>
              </wsdl:operation>
         </wsdl:portType>
         <!-- portType implemented by the requester of RegistrationUpload BPEL process
         for asynchronous callback purposes
         -->
         <wsdl:portType name="RegistrationUploadCallback">
              <wsdl:operation name="processResponse">
                   <wsdl:input message="client:RegistrationUploadResponseMessage"/>
              </wsdl:operation>
         </wsdl:portType>
         <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         PARTNER LINK TYPE DEFINITION
         the RegistrationUpload partnerLinkType binds the provider and
         requester portType into an asynchronous conversation.
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
         <plnk:partnerLinkType name="RegistrationUpload">
              <plnk:role name="RegistrationUploadProvider">
                   <plnk:portType name="client:RegistrationUpload"/>
              </plnk:role>
              <plnk:role name="RegistrationUploadRequester">
                   <plnk:portType name="client:RegistrationUploadCallback"/>
              </plnk:role>
         </plnk:partnerLinkType>
    </wsdl:definitions>
    uploadDataToPermananentDB.wsdl
    <?binding.jca uploadDataToPermananentDB_db.jca?>
    <wsdl:definitions name="uploadDataToPermananentDB"
    targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/db/RegistrationUpload/RegistrationUpload/uploadDataToPermananentDB"
    xmlns:db="http://xmlns.oracle.com/pcbpel/adapter/db/DAMSMGR/TEMP_TO_PERMANENTDB/"
    xmlns:tns="http://xmlns.oracle.com/pcbpel/adapter/db/RegistrationUpload/RegistrationUpload/uploadDataToPermananentDB"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/">
    <plt:partnerLinkType name="uploadDataToPermananentDB_plt">
    <plt:role name="uploadDataToPermananentDB_role">
    <plt:portType name="tns:uploadDataToPermananentDB_ptt"/>
    </plt:role>
    </plt:partnerLinkType>
    <wsdl:types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema">
    <import namespace="http://xmlns.oracle.com/pcbpel/adapter/db/DAMSMGR/TEMP_TO_PERMANENTDB/"
    schemaLocation="xsd/DAMSMGR_TEMP_TO_PERMANENTDB.xsd"/>
    </schema>
    </wsdl:types>
    <wsdl:message name="args_in_msg">
    <wsdl:part name="InputParameters" element="db:InputParameters"/>
    </wsdl:message>
    <wsdl:portType name="uploadDataToPermananentDB_ptt">
    <wsdl:operation name="uploadDataToPermananentDB">
    <wsdl:input message="tns:args_in_msg"/>
    </wsdl:operation>
    </wsdl:portType>
    </wsdl:definitions>
    please help me how to call the data adaper from my java code..
    hope i will get some hint in this forum...
    Edited by: user13370040 on Mar 22, 2011 5:55 AM

  • Inserting data to a . SDF database (SQL Server Compact Edition connection)

    Hi, all.
    I'm working on a project that worked fine while connecting to SQL Server 2008. I used a connection string like this:
    Driver={SQL Server Native Client 10.0};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
    Now, I've replaced all database connections in my project to work with SQL Server Compact Edition, and my connection string is something like this:
    Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=myDir\myDataBase.sdf; 
    After changing the type of connection, I'm getting an error on "DB Tools Insert Data.vi". This is what I get:
    Error -2147217872 occurred at NI_Database_API.lvlib:Cmd Execute.vi->NI_Database_API.lvlib: DB Tools Insert Data.vi->Main.vi
    Possible reason(s):ADO Error: 0x80040E30 Exception occured in Microsoft SQL Server Compact OLE DB Provider: The given type name was unrecognized. [,,,,,] in NI_Database_API.lvlib:Rec Create - Command.vi->NI_Database_API.lvlib:Cmd Execute.vi->NI_Database_API.lvlib: DB Tools Insert Data.vi->Main.vi
    This is a simplified block diagram (as I said, it worked perfectly while using SQL Server 2008 connection):
    Could you please help me?
    Thanks in advance,
    Francisco

    Hi, Steve. Thanks for your answers.
    I worked around this problem by using directly a SQL query instead of this function (you were right, using DBTools Execute Query VI). But now I'm getting problems with other functions, when inserting data into the DB including NULL values.
    I make a SQL query like this using DBTools Execute Query VI:
    INSERT INTO Table1 (Column1, Column2, Column3, Column4, Column5, Column6) VALUES ('Value1', 'Value2', 'Value3', 'NULL', 'Value5', 'Value6') 
    and get the following error:
    ADO Error: 0x80040E07Exception occured in Microsoft SQL Server Compact OLE DB Provider: A literal value in the command could not be converted to the correct type due to a reason other than data overflow. [,,,,,] in NI_Database_API.lvlib:Conn Execute.vi->INSERT (new) restricción (DBCT).vi->Restricciones a Base de Datos (DBCT).vi->Definir - editar restricciones.vi->Main.vi
    The same SQL query worked perfectly when using the SQL Server 2008 connection, so it's not a database structure issue.
    Could somebody please help me?
    Regards,
    Francisco

  • Using functions in insert statement

    Hi,
    I'm trying to insert data into an object view and I have an object date_object in one of the tables i'm inserting from. Here is the specification for date_object:
    create or replace type date_object as object
         (quarter     number,
         year          number(4),
         member procedure set_date(d in date_object),
         member procedure set_date(v_qtr in number, v_year in number),
         constructor function date_object(d in date_object) return self as result,
         --overriding constructor function date_object(v_qtr number, v_year number) return self as result,
         member function to_string return varchar2,
         member function get_quarter return number,
         member function get_year return number,
         member function get_quarter_as_string return varchar2);
    I'm trying to insert into my view like this:
    create or replace view balance_view of balance as
         (select bank_code,
              b.name,
              b.city,
              b.state,
              b.qdate.get_quarter_as_string(),
              b.qdate.get_year(),
              f.total_assets,
              (f.current_liabilities + f.long_term_liabilities)          
         from banks b join financial_data f using(bank_code));
    b.qdate is a date object from the banks table, i'm trying to call a member function to insert data into my view, however i get an error like this:
    ERROR at line 6:
    ORA-00904: "B"."QDATE"."GET_QUARTER_AS_STRING": invalid identifier
    Does anyone have an idea of what I may be doing wrong?

    Hi,
    I think you should alias the column names when you are creating a view.
    b.qdate.get_quarter_as_string(),  
    b.qdate.get_year(),
    (f.current_liabilities + f.long_term_liabilities) These three cannot be the name of the columns in the view.
    Can you please try that?
    I tried the following example and it is working fine.
    SQL> create type date_type as object(
      2  date_of_birth date,
      3  map member function get_age return number);
      4  /
    Type created.
    SQL> create type body date_type as
      2    map member function get_age return number is
      3    Begin
      4      return trunc((sysdate-date_of_birth)/365);
      5    end;
      6  end;
      7  /
    Type body created.
    SQL> create table person(
      2  id number,
      3  name varchar2(20),
      4  dob date_type);
    Table created.
      1* insert into person values (1,'test',date_type(to_date('01-01-1985','dd-mm-yyyy')))
    SQL> /
    1 row created.
    SQL> commit;
    SQL> select p.id,p.name,p.dob.get_age() from person p;
            ID NAME                 P.DOB.GET_AGE()
             1 test                              24
    SQL> create view test_view as
      2  select p.id,p.name,p.dob.get_age() age from person p;
    View created.
    SQL>  select * from test_view;
            ID NAME                   AGE
             1 test                      24Thanks,
    Rajesh.
    Added example.
    Edited by: Rchamarthi on Apr 27, 2009 7:09 PM

  • Create a trigger to check inserted date is before or after SYSDATE

    Hi,
    I am trying to create a trigger that will check an inserted date against SYSDATE and alter the value (i.e. make it SYSDATE) when the entered date is incorrect.
    For example, I have a Customer table with a record named MemberDate which, when a date is entered to it, will be checked by the trigger to ensure it is not before the current date.
    My code so far;
    CREATE OR REPLACE TRIGGER Customer
    BEFORE INSERT ON
    Customer
    FOR EACH ROW
    DECLARE
    e_invaliddate_ud EXCEPTION;
    BEGIN
    IF :NEW.MemberDate < SYSDATE THEN
    RAISE e_invaliddate_ud;
    END IF;
    EXCEPTION
    WHEN e_invaliddate_ud THEN
    DBMS_OUTPUT.PUT_LINE('The date entered for MemberDate is invalid. The
    MemberDate has been set to the current date');
    END;
    So far, this trigger only returns an error message but allows the date to be entered even if it is incorrect. I have tried a few ways of altering the entered date to SYSDATE but to no avail.
    I am running scripts using SQL PLUS and inserting data using
    INSERT INTO Customer
    VALUES(CustomerID, ..., MemberDate);
    Where the values entered will be checked to ensure the MemberDate is not before SYSDATE.
    The MemberDate data-type is DATE and has a rule that it must not be before the current date. I am aware that a constraint may not be used to perform a check using SYSDATE, this is why I am trying to make a trigger.
    However, my knowledge of triggers is limited
    If anyone can help, I will be very Happy.
    Thank you in advance.

    Use this if you want an error message that halts the execution:
    create or replace trigger customer
    before insert on customer
    for each row
    begin
      if :new.memberdate < sysdate
      then
        raise_application_error(-20000,'The date entered for MemberDate is invalid.');
      end if;
    end;Use this if you want to automatically to overwrite the MemberDate with sysdate without an error message:
    create or replace trigger customer
    before insert on customer
    for each row
    begin
      :new.memberdate := greatest(sysdate,:new.memberdate);
    end;Note: untested
    Regards,
    Rob.

  • SQL Function in a SSIS package

    I have data that I am importing from multiple DB2 servers.
    I have a SQL function that I need to run to process the DB2 data after it is imported.
    Does anyone know if there is a way to do this.  Call a SQL function to process data imported from a non-MSSQL server.
    Or should I use a staging table and use a stored procedure instead of a function.
    Thanks in advance.

    Function? A function you wrote on the SQL Server side like a scalar-valued function?
    If you say yes, then you can re-use it by having a staging table - just run the proper T-SQL against it.
    If not then use a staging table and use a stored procedure instead of a function
    Arthur
    MyBlog
    Twitter

  • GetData() to insert data into HANA

    Hi there,
    we struggle while using the getData() function to insert data into HANA.
    Here is our test coding:
        typedef [
           binary HeaderId;
        Timestamp  "Timestamp";
        string SystemType;
           string SystemId;
          | ] ts_Log_Header ;
    vector ( ts_Log_Header ) lt_Log_Header ;
                    getData( lt_Log_Header,
                              'ServiceHDBANA',
                              'Insert into "SAP_SEC_MON"."sap.secmon.db::Log.LogHeader" values ( ?, ?, ?,? )', WithNullIDs.HeaderId, WithNullIDs."Timestamp", 'PILLE', '');
    We see the following error in the console output as well as in the project log file:
    Error:
    2014-05-23 14:41:46.718 | 6924 | container | [SP-3-100005] (18.299) sp(18744) Error retrieving column 1 value from result set.
    2014-05-23 14:41:46.718 | 6924 | container | [SP-3-100005] (18.299) sp(18744) A result row is skipped due to error retrieving column data.
    2014-05-23 14:41:46.718 | 6924 | container | [SP-3-104003] (18.299) sp(18744) Error in function 'getData': Error iterating result set
    2014-05-23 14:41:46.734 | 6924 | container | [SP-4-131038] (18.315) sp(18744) Stream(): error occurred in computation of row.
    The according schema of the table in HANA looks like this:
    CREATE COLUMN TABLE "SAP_SEC_MON"."sap.secmon.db::Log.LogHeader" ("HeaderId" VARBINARY(16) CS_RAW,
      "Timestamp" LONGDATE CS_LONGDATE,
      "SystemType" NVARCHAR(50),
      "SystemId" NVARCHAR(5000))
    Any help would be appreciated.Or is there any example coding available ?
    We´re using ESP SP04 on a windows machine.

    Hi,
    Create a procedure in HANA that handles the insert, and have it return a dummy record, something similar to this:
    HANA Procedure:
    CREATE PROCEDURE insert_stock (symbol varchar(10), volume integer, price float)
    LANGUAGE SQLSCRIPT AS
    BEGIN
       INSERT INTO "SYSTEM"."stock"  values(symbol, volume, price);
       SELECT ::ROWCOUNT FROM DUMMY;
    END
    ESP CCL:
    CREATE INPUT stream StockStream SCHEMA (symbol string, volume integer, price float);
    CREATE Flex stock_flex
       IN StockStream
       OUT OUTPUT STREAM stock_traded SCHEMA(symbol string, volume integer, price float)
       BEGIN
          DECLARE
             /* The typedef must be the same as the return value of the stored procedure.            */
             typedef [integer dummydata;|] datarec;
             /* dummydatarec is a vector variable to store the return value of the stored procedure  */
             vector(datarec) dummydatarec;
          END;
          ON StockStream {
             if ( isnull(dummydatarec) ) {
                dummydatarec := new vector(datarec);                 
             getData(dummydatarec, 'HANAODBCService',
                 'CALL "SYSTEM"."INSERT_STOCK" (?,?,?)',
                  StockStream.symbol, StockStream.volume, StockStream.price );
             resize(dummydatarec,0);
       END;
    Hope that helps!
    Thanks,
    Alice

  • Calling webservice in udf for inserting data into webservice

    Dear Experts,
          Please give me the drawbacks of using lookup function for inserting data. we are calling a webservice from the udf for inserting the data using a webservice.
    It is a file to jdbc usnig a soap lookup . we use this approach because we need to pass the response from webservice along with the error data to the jdbc.   is there any other way to do it without using bpm ?
        In the udf we are creating the xml structure for webservice and passing the parameters through arguments.
    is there a better approach for this ?
    Thanks,
    Aju

    Hi Aju,
    You can do it without BPM.
    Write UDF for Soap Lookup. Parse the response message from Webservice.  and map the required values to respective fields.
    See the weblog
    Webservice Calls From a User Defined Function.
    Negative point of this solution is that it will take some time to call Webservice and get response back from it.
    Kulwinder

  • Best Practice for ViewObjects when inserting data through pl/sql procedure

    My applications is oracle form based enterprise level application and we are now developing new module in ADF 11g but there is restriction that all data insertion, updation, and deletion will be through oracle pl/sql procedures. Now my question is that adf pages should be binded with ViewObjects based on Entity Object or with Viewobjects not based on Entity / sql query. Currently I have developed pages with programmatic ViewObjects which are neither based on Entity Objects nor on sql query. In those view objects, i create transient attributes and then used it to create adf pages. Then on save, i extract the data from ViewObject's current row and pass it to procedure. This is working fine but just wondering whether this approach is ok or there is better alternative for that. Ideally i want to create ViewObjects based on EntityObject but don't finding any way to synchronize entityObjects with data inserted through procedures.

    Hi,
    I create a EO for the Database-View and override the doDML()-Method. For insert/update and delete I call the pl/sql-functions.
    See "38.5 Basing an Entity Object on a PL/SQL Package API" in Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development
    Framework.

  • Open SQL (difference between 2 dates) - DATEDIFF function

    Hello Experts,
    In my DB I created a TABLE with a column "<b>GIORNO</b>" that contains dates (in format 'yyyy-mm-dd'). I need to get the difference between the current day and the most recent date inserted into the table.
    I'm using a Java DAO class to execute a query.
    My problem is that the function <b>DATEDIFF(a,b)</b> explained in help.sap.com (http://help.sap.com/saphelp_nw70/helpdata/en/d2/f61996bb5e11d2a97100a0c9449261/content.htm) is not accepted by my portal..
    I wrote a query that contains <b>DATEDIFF( MAX(GIORNO) , ? )</b> where '?' is the current date..
    And my system return to me the error message:
    <i>SQL syntax error: the token "(" was not expected here</i> (referring to the <u>dateDiff '('</u> )
    In some forum I found that someone uses <b>DATEDIFF(a,b, getdate())</b> but it still does not work.....
    Any suggestion??
    Best Regards

    Hi Andy,
    thanks for your fast answer..
    SYSDATE does not work because is an Oracle SQL function..
    Anyway I think that the problem is the DATEDIFF function that is not recognised (infact the error message says that it does not expect the '('...
    I show to you the error message using <b>DATEDIFF(MAX(GIORNO), SYSDATE)</b> :
    <i>HTTP/1.1 500 Internal Server Error
    Connection: close
    Server: SAP J2EE Engine/7.00
    Content-Type: text/xml; charset=UTF-8
    Date: Wed, 26 Sep 2007 13:29:02 GMT
    Set-Cookie: <value is hidden>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>java.sql.SQLException: com.sap.sql.log.OpenSQLException: The SQL statement "<b>SELECT NOMESETTORE, DATEDIFF(MAX(GIORNO),SYSDATE) AS GIORNI FROM SRS_DATEINFORTUNI WHERE NOMEDITTA = ? AND NOMEAREA= ? GROUP BY NOMESETTORE ORDER BY NOMESETTORE</b>" contains the syntax error[s]: - <u>1:29 - SQL syntax error: the token "(" was not expected here</u></faultstring><detail><ns1:getGiorniSettori_com.akhela.giorniSenzaInfortuni.ejb.exception.GiorniSenzaInfortuniException xmlns:ns1='urn:GiorniSenzaInfortuniWSWsd/GiorniSenzaInfortuniWSVi'></ns1:getGiorniSettori_com.akhela.giorniSenzaInfortuni.ejb.exception.GiorniSenzaInfortuniException></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope></i>

  • 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.
    |

Maybe you are looking for