How to output value from stored procedure

Hi folks, I need to output the OrderFK from a stored procedure not really sure how to achieve this any help or tips much appreciated.
Sql code below
USE [TyreSanner]
GO
/****** Object: StoredProcedure [dbo].[AddCustomerDetails] Script Date: 11/12/2014 20:56:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[AddCustomerDetails]
/***********************Declare variables ***********************/
/******tblCustomer******/
@Forename nvarchar(50),
@Surname nvarchar(50),
@HouseNo nvarchar(50),
@CustAddress nvarchar(50),
@Town nvarchar(50),
@Postcode nvarchar(50),
@ContactNo nvarchar(50),
@EmailAddress nvarchar(50),
/******tblLink_OrderProduct******/
@ProductQuantity int,
@TotalProductSaleCost decimal,
@ProductFK int,
@FittingDate date,
@FittingTime Time
As
DECLARE @CustomerFK int;
DECLARE @OrderFK int;
Begin TRANSACTION
SET NOCOUNT ON
INSERT INTO [TyreSanner].[dbo].[Customer](Forename, Surname, HouseNo, CustAddress, Town, Postcode, ContactNo, EmailAddress)
VALUES (@Forename,@Surname,@HouseNo,@CustAddress,@Town,@Postcode,@ContactNo,@EmailAddress)
Set @CustomerFK = SCOPE_IDENTITY()
INSERT INTO [TyreSanner].[dbo].[Order] (CustomerFK)
VALUES (@CustomerFK)
SET @OrderFK = SCOPE_IDENTITY()
INSERT INTO [TyreSanner].[dbo].[Link_OrderProduct](OrderFK, ProductFK, ProductQuantity, TotalProductSaleCost, FittingDate, FittingTime)
VALUES
(@OrderFK, @ProductFK, @ProductQuantity, @TotalProductSaleCost, @FittingDate, @FittingTime)
COMMIT TRANSACTION

Hi brucey54,
There’re several ways to capture the value from a Stored Procedure. In you scenario, I would suggest 2 options, by an output parameter or by a table variable.
By an output Parameter, you need to make a little bit modification on your code as below:
USE [TyreSanner]
GO
ALTER PROCEDURE [dbo].[AddCustomerDetails]
@Forename nvarchar(50),
@FittingDate date,
@FittingTime Time,
@OrderFK int output
As
DECLARE @CustomerFK int;
--DECLARE @OrderFK int;
Run the following code, Then @OrderFKvalue holds the value you’d like.
DECLARE @OrderFKvalue int;
EXEC AddCustomerDetails(your parameters,@OrderFKvalue output)
Anyway if you don’t like to add one more parameter, you can get the value by a table variable as well. Please append “SELECT @OrderFK;” to your Procedure as below:
USE [TyreSanner]
GO
ALTER PROCEDURE [dbo].[AddCustomerDetails]
SET @OrderFK = SCOPE_IDENTITY()
INSERT INTO [TyreSanner].[dbo].[Link_OrderProduct](OrderFK, ProductFK, ProductQuantity, TotalProductSaleCost, FittingDate, FittingTime)
VALUES
(@OrderFK, @ProductFK, @ProductQuantity, @TotalProductSaleCost, @FittingDate, @FittingTime);
SELECT @OrderFK;
Then you can call the Stored Procedure as below:
DECLARE @T TABLE (OrderFK INT);
INSERT @T EXEC AddCustomerDetails(your parameters) ;
SELECT OrderFK FROM @T;
There’re more options to achieve your requirement, please see the below link:
How to Share Data between Stored Procedures
If you have any question, feel free to let me know.
Best Regards,
Eric Zhang

Similar Messages

  • How to get return values from stored procedure to ssis packge?

    Hi,
    I need returnn values from my stored procedure to ssis package -
    My procedure look like  and ssis package .Kindly help me to oget returnn value to my ssis package
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author: <Author,,Name>
    -- Create date: <Create Date,,>
    -- Description: <Description,,>
    -- =============================================
    ALTER PROCEDURE [TSC]
    -- Add the parameters for the stored procedure here
    @P_STAGE VARCHAR(2000)
    AS
    BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
    -- Insert statements for procedure here
    --SELECT <@Param1, sysname, @p1>, <@Param2, sysname, @p2>
    truncate table [INPUTS];
    INSERT
    INTO
    [INPUTS_BASE]
    SELECT
    [COLUMN]
    FROM [INPUTS];
    RETURN
    END
    and i am trying to get the return value from execute sql task and shown below
    and i am taking my returnn value to result set variable

    You need to have either OUTPUT parameters or use RETURN statement to return a value in stored procedures. RETURN can only return integer values whereas OUTPUT parameters can be of any type
    First modify your procedure to define return value or OUTPUT parameter based on requirement
    for details see
    http://www.sqlteam.com/article/stored-procedures-returning-data
    Once that is done in SSIS call sp from Execute SQL Task and in parameter mapping tabe shown above add required parameters and map them to variables created in SSIS and select Direction as Output or Return Value based on what option you used in your
    procedure.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to capture return value from stored procedure?

    Hi All,
    I want to capture the retun values from this procedure to a table - CALL SYS.GET_OBJECT_DEFINITION('SCHEMA_NAME', 'TABLE_NAME').
    The below approach is not working -
    Insert  into STG.STG_DDL
    Call SYS.GET_OBJECT_DEFINITION('DWG', 'DWG_SITE')
    Could you please have a look on the same?
    Thank you,
    Vijeesh

    Thanks a lot Everyone.
    Considering the discussed options, and an approach explained in this thread - -http://scn.sap.com/thread/3291461  , I have written an SQL to build the Alter statements to add the columns & Constrains to table.
    The below Query will provide the scripts to build a table in another environment.
    select * from (
       select TABLE_name,'tbl_Create' column_name, 1 as position, 'CREATE TABLE '|| schema_name ||'.'|| table_name ||' (  DUMMY_CLMN INTEGER);' as SQLCMD
         from tableS
        where  schema_name ='DWG'
          and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
    UNION ALL
    -- MASS change of NOT NULL COLUMNS
    -- set to NOT NULL - character data type, double, decimal fixed - need the length but not the scale
       select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||') NOT NULL) ;' as SQLCMD
         from table_columns
        where is_nullable = 'FALSE'
          and schema_name ='DWG'
          and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
          and data_type_name in ('VARCHAR', 'NVARCHAR', 'DOUBLE')
          and scale is NULL
    UNION ALL
    -- MASS change of NOT NULL COLUMNS
    -- set to NOT NULL - character data type, double, decimal fixed - need the length but not the scale
       select TABLE_name,column_name, position + 100,'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||') );' as SQLCMD
         from table_columns
        where is_nullable = 'TRUE'
          and schema_name ='DWG'
          and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
          and data_type_name in ('VARCHAR', 'NVARCHAR', 'DOUBLE')
          and scale is NULL
    UNION ALL
    -- set to NOT NULL - DECIMAL (FLOATING POINT)- needs length and scale
       select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||','|| scale ||') NOT NULL) ;' as SQLCMD
         from table_columns
        where is_nullable = 'FALSE' 
          and schema_name ='DWG'
          and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
          and data_type_name in ('DECIMAL' )
          and scale is not null
    UNION ALL
    -- set to NOT NULL - DECIMAL (FLOATING POINT)- needs length and scale
       select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||','|| scale ||') ) ;' as SQLCMD
         from table_columns
        where is_nullable = 'TRUE'
          and schema_name ='DWG'
          and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
          and data_type_name in ('DECIMAL' )
          and scale is not null
    UNION ALL
    -- set to NOT NULL - DECIMAL (FLOATING POINT)- needs length and null scale
       select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||') NOT NULL) ;' as SQLCMD
         from table_columns
        where is_nullable = 'FALSE' 
          and schema_name ='DWG'
          and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
          and data_type_name in ('DECIMAL' )
          and scale is  null
    UNION ALL
    -- set to NOT NULL - DECIMAL (FLOATING POINT)- needs length and null scale
       select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||') NOT NULL) ;' as SQLCMD
         from table_columns
        where is_nullable = 'TRUE'
          and schema_name ='DWG'
          and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
          and data_type_name in ('DECIMAL' )
          and scale is  null
    UNION ALL
    -- set to NOT NULL -  DATE | TIME | SECONDDATE | TIMESTAMP | TINYINT | SMALLINT | INTEGER - don't need length  or scale
    select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' NOT NULL) ;' as SQLCMD
       from table_columns
      where is_nullable = 'FALSE'
        and schema_name ='DWG'
        and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
        and data_type_name in ('DATE', 'LONGDATE', 'TIME', 'SECONDDATE', 'TIMESTAMP', 'TINYINT', 'SMALLINT', 'INTEGER' )
    --   and scale is not null   
    UNION ALL
    -- set to NOT NULL -  DATE | TIME | SECONDDATE | TIMESTAMP | TINYINT | SMALLINT | INTEGER - don't need length  or scale
    select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' ) ;' as SQLCMD
       from table_columns
      where is_nullable = 'TRUE'
        and schema_name ='DWG'
        and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
        and data_type_name in ('DATE', 'LONGDATE', 'TIME', 'SECONDDATE', 'TIMESTAMP', 'TINYINT', 'SMALLINT', 'INTEGER' )
    --    and scale is not null
    UNION ALL
    select table_name, 'PK' AS column_name, 9990, 'ALTER TABLE '||table_name||' ADD CONSTRAINT Primary_key PRIMARY KEY ('||PK_COLUMN_NAME1||
    case when  PK_COLUMN_NAME2 is null then  ' ' else ','|| PK_COLUMN_NAME2 end ||
    case when  PK_COLUMN_NAME3 is null then  ' ' else ','|| PK_COLUMN_NAME3 end ||
    case when  PK_COLUMN_NAME4 is null then  ' ' else ','|| PK_COLUMN_NAME4 end ||');'
    from
    (SELECT DISTINCT C1.table_name , C1.COLUMN_NAME AS PK_COLUMN_NAME1, C2.COLUMN_NAME AS PK_COLUMN_NAME2, C3.COLUMN_NAME AS PK_COLUMN_NAME3, C4.COLUMN_NAME AS PK_COLUMN_NAME4
                         FROM (SELECT * FROM CONSTRAINTS WHERE POSITION=1 AND IS_PRIMARY_KEY = 'TRUE') C1
                         LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=2 AND IS_PRIMARY_KEY = 'TRUE') C2
                                ON C1.table_name = C2.table_name
                         LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=3 AND IS_PRIMARY_KEY = 'TRUE') C3
                                ON C2.table_name = C3.table_name
                         LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=4 AND IS_PRIMARY_KEY = 'TRUE') C4
                                ON C3.table_name = C4.table_name
                         LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=5 AND IS_PRIMARY_KEY = 'TRUE') C5
                                ON C4.table_name = C5.table_name
                         ) PK     
    where table_name = 'DWG_PRODUCTION_VOLUME_TRX'
    UNION ALL
    select table_name, 'UK' AS column_name, 9991,  'ALTER TABLE '||table_name||' ADD CONSTRAINT UNIQUE ('||UK_COLUMN_NAME1||
    case when  UK_COLUMN_NAME2 is null then  ' ' else ','|| UK_COLUMN_NAME2 end ||
    case when  UK_COLUMN_NAME3 is null then  ' ' else ','|| UK_COLUMN_NAME3 end ||
    case when  UK_COLUMN_NAME4 is null then  ' ' else ','|| UK_COLUMN_NAME4 end ||');'
    FROM
    (SELECT DISTINCT C1.table_name , C1.COLUMN_NAME AS UK_COLUMN_NAME1, C2.COLUMN_NAME AS UK_COLUMN_NAME2, C3.COLUMN_NAME AS UK_COLUMN_NAME3, C4.COLUMN_NAME AS UK_COLUMN_NAME4
                         FROM (SELECT * FROM CONSTRAINTS WHERE POSITION=1 AND IS_PRIMARY_KEY = 'FALSE') C1
                         LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=2 AND IS_PRIMARY_KEY = 'FALSE') C2
                                ON C1.table_name = C2.table_name
                         LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=3 AND IS_PRIMARY_KEY = 'FALSE') C3
                                ON C2.table_name = C3.table_name
                         LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=4 AND IS_PRIMARY_KEY = 'FALSE') C4
                                ON C3.table_name = C4.table_name
                         LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=5 AND IS_PRIMARY_KEY = 'FALSE') C5
                                ON C4.table_name = C5.table_name
                         ) UK    
    where table_name = 'DWG_PRODUCTION_VOLUME_TRX'
    UNION ALL
    SELECT REFERENCED_TABLE_NAME AS table_name,'FK' AS column_name, 9992,
    'ALTER TABLE DWG.'||TABLE_NAME||' ADD FOREIGN KEY ( '||COLUMN_NAME||' ) REFERENCES '|| REFERENCED_TABLE_NAME||'('||COLUMN_NAME||' ) ON UPDATE CASCADE ON DELETE RESTRICT;'
    FROM REFERENTIAL_CONSTRAINTS
    WHERE REFERENCED_TABLE_NAME = 'DWG_SITE'
    UNION ALL
    select TABLE_name,'tbl_ClmnDrop' column_name, 9995 as position, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' DROP (  DUMMY_CLMN );' as SQLCMD
    from tableS
    where  schema_name ='DWG'
      and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
    order by position;

  • How to extract values from pricing procedure for conditions in CRM Billing?

    I have a number of conditions in the pricing procedure in CRM Billing that I would like to extract to SAP BW. How can this be done?
    Is there a standard extractor for CRM Billing similar to the SD Billing extractor "Extraction of SD Billing Conditions" (2LIS_13_VDKON)?
    If there is no standard extractor, is there another way to extract the conditions and the related values?
    I am using the standard CRM Billing Extractor 0BEA_CRMB already, so maybe an append could solve my problem. How can this be done? In what CRM-tables can I find the values from pricing procedure for conditions in CRM Billing?

    you may want to post that last question in a CRM forum... in ECC it would be table KONV

  • How to retrieve Table of Records output param from stored procedure ?

    Hi,
    I'm trying to retrieve data from a PL/SQL stored proc. It seems I can't modify this procedure (I'm not allowed to and I don't know PL/SQL :)).
    My only documentation is the PL/SQL code and its comments. And that's the first I have to deal with output of a defined complex PL/SQL type
    So the signature of the procedure is :
    FUNCTION FUN_AFF_EVELEG_IHM (
        pEntumTyp       IN          NUMBER,
        pEntnum         IN          VARCHAR2,
        pEveListSize      IN OUT      NUMBER,
        pEveList       IN OUT      pkg_funaff_eveleg.TableRecordEVL,
        pErrCode   IN OUT      VARCHAR2,
        pMessage        IN OUT      VARCHAR2)
      RETURN NUMBER;pkg_funaff_eveleg.TableRecordEVL type is defined as "TABLE of RecordEVL"
    pkg_funaff_eveleg.RecordEVL type is defined as "RECORD" (struct of 12 different fields : NUMBER or VARCHAR2)
    What is the correct syntax to call the stored procedure then ? I don't find how to manage the pEveList output param. Is it a Cursor ? An ARRAY ? And how to register it ?
    My code so far :
    public static void callFunaffEVL(Connection con, String rcs) {
        // CallableStatement procCstmt=null;
        OracleCallableStatement oraCstmt = null;
        try {
          // Identifiy the Stored procedure
          // package synonyme : pkg_aff_EVELEG_IHM
          // stored procedure name : FUN_AFF_EVELEG_IHM
          String command = new StringBuilder("{? = call pkg_aff_EVELEG_IHM.FUN_AFF_EVELEG_IHM(?,?,?,?,?,?");
          // 1 RETURN 
          // 2 pEntumTyp IN NUMBER
          // 3 pEntnum IN VARCHAR2
          // 4 pEveListSize IN OUT NUMBER,
          // 5 pEveList IN OUT pkg_funaff_eveleg.TableauRecordEVL,
          // 6 pErrCpde IN OUT VARCHAR2,
          // 7 pMessage IN OUT VARCHAR2)
          // Create a Callable Statement Object:
          oraCstmt = (OracleCallableStatement) con.prepareCall(command);
          // Assign IN and OUT parameters
          oraCstmt.registerOutParameter(1, OracleTypes.NUMBER); // RET
          oraCstmt.setInt(2, 0); // ENTNUMTYP
          oraCstmt.setString(3, rcs); // ENTNUM
          oraCstmt.registerOutParameter(4, OracleTypes.NUMBER); // pEveListSize
          oraCstmt.registerOutParameter(5, OracleTypes.ARRAY); // pEveList
          oraCstmt.registerOutParameter(6, OracleTypes.VARCHAR); // pErrCode
          oraCstmt.registerOutParameter(7, OracleTypes.VARCHAR); // pMessage
          // Execute the Procedure or Function Call:
          oraCstmt.execute();
          // Process the OUT Placeholders:
          int ret = oraCstmt.getInt(1);
          String errCode = oraCstmt.getString(6);
          String message = oraCstmt.getString(7);
          System.out.println("RCS : " + rcs);
          System.out.println("ret : " + ret);
          System.out.println("errCode : " + errCode );
          System.out.println("message : " + message);
        } catch (SQLException sqle) {
          sqle.printStackTrace();
        } finally {
          // Close the CallableStatement Object:
          try {
            oraCstmt.close();
          } catch (SQLException e) {
            e.printStackTrace();
    Return : java.sql.SQLException: Parameter type Conflict: sqlType=2003
    Any help ? I found several examples that might refer to this case, but everything I tried end by a SQL exception of one type or another...
    (and sorry for my poor english :))
    Cy

    As I said, "pkg_funaff_eveleg.TableRecordEVL" is TABLE of RecordEVL.
    i.e : I can find 2 defined types under the package pkg_funaff_eveleg :
    TYPE TableRecordEVL is TABLE of RecordEVL INDEX BY BINARY_INTEGER;
    TYPE RecordEVL is RECORD (
      EVLENTNUM_PK        EVENEMENTS_LEGAUX.EVLENTNUM_PK%TYPE,
      EVLENTNUMTYP_PK     EVENEMENTS_LEGAUX.EVLENTNUMTYP_PK%TYPE,
      EVLSEQ_PK           EVENEMENTS_LEGAUX.EVLSEQ_PK%TYPE,
      EVLTYPSRC           EVENEMENTS_LEGAUX.EVLTYPSRC%TYPE,
      EVLPK1              EVENEMENTS_LEGAUX.EVLPK1%TYPE,
      EVLPK2              EVENEMENTS_LEGAUX.EVLPK2%TYPE,
      EVLPK3              EVENEMENTS_LEGAUX.EVLPK3%TYPE,
      EVLPK4              EVENEMENTS_LEGAUX.EVLPK4%TYPE,
      EVLPK5              EVENEMENTS_LEGAUX.EVLPK5%TYPE,
      EVLPK6              EVENEMENTS_LEGAUX.EVLPK6%TYPE,
      EVLCODEVTSRC        EVENEMENTS_LEGAUX.EVLCODEVTSRC%TYPE,
      EVLLEGEVECOD        EVENEMENTS_LEGAUX.EVLLEGEVECOD%TYPE,
      EVLSEQREF_FK        EVENEMENTS_LEGAUX.EVLSEQREF_FK%TYPE,
      EVLCOMMENT          EVENEMENTS_LEGAUX.EVLCOMMENT%TYPE,
      EVLETATCOD          EVENEMENTS_LEGAUX.EVLETATCOD%TYPE,
      EVLHISDATPUB        EVENEMENTS_LEGAUX.EVLHISDATPUB%TYPE,
      EVLHISPUBPRE        EVENEMENTS_LEGAUX.EVLHISPUBPRE%TYPE,
      EVLHISDATEFF        EVENEMENTS_LEGAUX.EVLHISDATEFF%TYPE,
      EVLHISEFFPRE        EVENEMENTS_LEGAUX.EVLHISEFFPRE%TYPE,
      EVLHISPOIDATEFF     EVENEMENTS_LEGAUX.EVLHISPOIDATEFF%TYPE,
      EVLHISORICOD        EVENEMENTS_LEGAUX.EVLHISORICOD%TYPE,
      EVLHISSUPPORTCOD    EVENEMENTS_LEGAUX.EVLHISSUPPORTCOD%TYPE,
      EVLHISNUMSUPPORT    EVENEMENTS_LEGAUX.EVLHISNUMSUPPORT%TYPE,
      EVLHISNUMINF        EVENEMENTS_LEGAUX.EVLHISNUMINF%TYPE,
      ANNNUMBODPCL        CBODACCPROD.CODANN2.ANNNUMBOD%TYPE
    );If needed, I can translate each "EVENEMENTS_LEGAUX.EVLENTNUM_PK%TYPE", but they must be VARCHAR2 or NUMBER
    Do I answer your question ?

  • Copy values from stored procedure to a text pad

    Any Suggestions
    We have a table 'A' and wrote a select query to get the values from that table 'A'. I place this select query in Stored procedure and when I run that procedure every month the output should be sent t a text pad. Any suggestions how to write it
    thanks
    Is there any other method if we dont have the privelage to create directory?
    Edited by: user646635 on Oct 2, 2008 7:16 AM

    user646635 wrote:
    want to store the output in a text file?
    we are using oracle 9iHere's a basic example for you...
    AS SYS:
    create or replace directory TEST_DIR as 'c:\test_dir'; -- This creates an oracle directory object.  The actual operating system directory must be created manually
    grant read,write on directory test_dir to my_user;  -- Grant permission to use that directory object to the required user(s)AS my_user:
    declare
      cursor cur_emp is
        select ename, deptno
        from emp;
      v_fh UTL_FILE.FILE_TYPE;  -- This is a file handle
    begin
      v_fh := UTL_FILE.FOPEN('TEST_DIR', 'file.txt', 'w', 32767);  -- Open the file for writing and obtain a handle to it
      FOR i IN cur_emp -- process the query in a loop
      LOOP
        UTL_FILE.FPUT_LINE(v_fh, i.ename||','||to_char(i.deptno,'fm099')); -- write out lines of text to the file
      END LOOP;
      UTL_FILE.FCLOSE(v_fh); -- Close the file (also flushes any unwritten buffered data).
    end;

  • HOW TO PASS VALUE TO STORED PROCEDURE through page

    Hi
    I want to create generate next number on base of type. I have created stored procedure with passing  three value input. If I am passing value manually through page then next number is generating. But I don't to pass value manually, I have to assign value internally as per database record.
    Sameh Nassar: Create PL/SQL Function And Call It From Your ADF Application
    I did same thing in my application,It is working,Output like that
    Value = INV
    Result= 26400080
    Now I have to assign value TRANSCATION  TYPE through bean class or  assign another textbox value. I did in my program in the following ways
       <af:inputText value="INV"
                                                              label="#{bindings.p_transaction_type.hints.label}"
                                                              required="#{bindings.p_transaction_type.hints.mandatory}"
                                                              columns="#{bindings.p_transaction_type.hints.displayWidth}"
                                                              maximumLength="#{bindings.p_transaction_type.hints.precision}"
                                                              shortDesc="#{bindings.p_transaction_type.hints.tooltip}"
                                                              id="it16" binding="#{InvoiceJobOrderBean.transacation_type}"
                                                              partialTriggers="it16">
                                                    <f:validator binding="#{bindings.p_transaction_type.validator}"/>
                                                </af:inputText>
    then  I got the following error.
    <MethodExpressionActionListener> <processAction> Received 'javax.faces.event.AbortProcessingException' when invoking action listener '#{bindings.generateNextNumber.execute}' for component 'cb2'
    <MethodExpressionActionListener> <processAction> javax.faces.event.AbortProcessingException: ADFv: Abort processing exception.
      at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:199)
      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 com.sun.el.parser.AstValue.invoke(Unknown Source)
      at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
      at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
      at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)
      at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
      at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcast(UIXComponentBase.java:824)
      at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:179)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
      at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:112)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
      at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:106)
      at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:159)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1137)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:361)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
      at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
      at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
      at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
      at java.security.AccessController.doPrivileged(Native Method)
      at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
      at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
      at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
      at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
      at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    <Utils> <buildFacesMessage> ADF: Adding the following JSF error message: ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at "WSAEEAPP.PK_SEC", line 114
    ORA-01403: no data found
    ORA-06512: at line 1
    java.sql.SQLException: ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at "WSAEEAPP.PK_SEC", line 114
    ORA-01403: no data found
    ORA-06512: at line 1
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
      at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)
      at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)
      at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)
      at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)
      at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:213)
      at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1111)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1488)
      at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3769)
      at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3904)
      at oracle.jdbc.driver.OracleCallableStatement.executeUpdate(OracleCallableStatement.java:9417)
      at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1512)
      at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:172)
      at model.AppModuleImpl.callStoredFunction(AppModuleImpl.java:150)
      at model.AppModuleImpl.generateNextNumber(AppModuleImpl.java:176)
      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.adf.model.binding.DCInvokeMethod.invokeMethod(DCInvokeMethod.java:655)
      at oracle.adf.model.binding.DCDataControl.invokeMethod(DCDataControl.java:2162)
      at oracle.adf.model.bc4j.DCJboDataControl.invokeMethod(DCJboDataControl.java:3088)
      at oracle.adf.model.binding.DCInvokeMethod.callMethod(DCInvokeMethod.java:266)
      at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1626)
      at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2169)
      at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:731)
      at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:402)
      at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:252)
      at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:185)
      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 com.sun.el.parser.AstValue.invoke(Unknown Source)
      at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
      at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
      at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)
      at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
      at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcast(UIXComponentBase.java:824)
      at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:179)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
      at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:112)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
      at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:106)
      at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:159)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1137)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:361)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
      at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
      at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
      at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
      at java.security.AccessController.doPrivileged(Native Method)
      at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
      at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
      at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
      at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
      at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    <Utils> <buildFacesMessage> ADF: Adding the following JSF error message: ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at "WSAEEAPP.PK_SEC", line 114
    ORA-01403: no data found
    ORA-06512: at line 1
    java.sql.SQLException: ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at "WSAEEAPP.PK_SEC", line 114
    ORA-01403: no data found
    ORA-06512: at line 1
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
      at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)
      at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)
      at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)
      at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)
      at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:213)
      at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1111)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1488)
      at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3769)
      at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3904)
      at oracle.jdbc.driver.OracleCallableStatement.executeUpdate(OracleCallableStatement.java:9417)
      at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1512)
      at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:172)
      at model.AppModuleImpl.callStoredFunction(AppModuleImpl.java:150)
      at model.AppModuleImpl.generateNextNumber(AppModuleImpl.java:176)
      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.adf.model.binding.DCInvokeMethod.invokeMethod(DCInvokeMethod.java:655)
      at oracle.adf.model.binding.DCDataControl.invokeMethod(DCDataControl.java:2162)
      at oracle.adf.model.bc4j.DCJboDataControl.invokeMethod(DCJboDataControl.java:3088)
      at oracle.adf.model.binding.DCInvokeMethod.callMethod(DCInvokeMethod.java:266)
      at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1626)
      at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2169)
      at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:731)
      at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:402)
      at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:252)
      at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:185)
      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 com.sun.el.parser.AstValue.invoke(Unknown Source)
      at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
      at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
      at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)
      at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
      at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcast(UIXComponentBase.java:824)
      at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:179)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
      at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:112)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
      at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
      at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:106)
      at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:159)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1137)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:361)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
      at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
      at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
      at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
      at java.security.AccessController.doPrivileged(Native Method)
      at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
      at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
      at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
      at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
      at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

    hi user,
    please don't continue  your discussion on others thread.
    https://forums.oracle.com/thread/369112
    it will be treated as hijacking.  Admin will lock out the thread. and your problem is contrary to the thread.
    coming to your problem,
    did you ever get a chance to read the error it is self explanatory. or else goggle it out to understand.
    It is not operation binding problem. while invoking the operation binding you are calling some db function from there you caught.
    coming to your requirement,
    create generate next number on base of type. please check will multi user environment it working properly or not.

  • How to get CLOB from stored procedure via StoredProcedureCall

    hi all
    I got "sp" on server : procedure get_text(p_in in varchar2, o_list out clob);
    in code:
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("get_text");
    call.addNamedArgumentValue("p_in", new String("MyList"));
    call.addNamedOutputArgument("o_list"); // <- out CLOB
    Vector v = (Vector)this.m_UnitOfWorkt.executeSelectingCall( call ); // <- here I got error
    but if o_list is varchar is all ok
    so how to get data from clob?
    Please help
    Regards
    Krzysztof

    Post Author: achaithanya
    CA Forum: Data Connectivity and SQL
    I'm connecting to database through stored procedure only.We have sybase installed on our local system so that we are given permissions only to access the stored procedures.When u see the fields in CR XI i.e Field explorer you are able to see only 1st result fileds.I connected to sybase and there i'm able to see the output of 1st & 2nd Result set.
    Regards,
    Chaithanya.

  • Get out values from stored procedure

    Hi folks,
    I have need of an aid. I have created this stored procedure:
    CREATE OR REPLACE PROCEDURE ProceduraDiProva (
    p_val1 IN NUMBER DEFAULT 1,
    p_val2 IN NUMBER DEFAULT 1,
    p_val3 OUT NUMBER,
    p_val4 OUT NUMBER)
    AS
    BEGIN
    p_val3 := p_val1 + p_val2;
    p_val4 := 999;
    END ProceduraDiProva;
    I call the procedure into shell script
    $ORACLE_HOME/bin/sqlplus -s user/pwd@oracleid > oracle.log << END
    spool ciccio.txt
    declare
    var a_out number;
    var b_out number;
    begin
    var a_out:=0;
    exec ProceduraDiProva(1, 2, a_out, b_out);
    end;
    spool off;
    exit
    END
    I would know as I make to insert 'a_out' and 'b_out' in a shell variables
    Tanks in advance

    I found an example with windows
    Create a file cmd with;
    FOR /F "usebackq delims=!" %%i IN (`sqlplus -s %usuario%/%pwd%@%ddbb% @1.sql`) DO set xresult=%%i
    echo %xresult%
    And the 1.sql:
    set timing off
    set feedback off
    set pages 0
    select sysdate from dual;
    exit
    ------------------------------------------------------------------------------------------

  • JDBC - How to Get Data from Stored Procedure?

    Gurus,
    I am using Oracle Thin JDBC driver. A stored procedure has an IN parameter and an OUT parameter. The type of OUT parameter is TABLE of RECORD which is defined in the PL/SQL package in which the stored procedure is included. My question is if there is any way to call this stored procedure and process the data returned by the OUT parameter in my Java code.
    Thanks.
    Larry

    define in the pl/sql block as a cursor
    register the out parameter as an oracle.cursor
    on the java program get an object (from the statement), casting it to an resultset and then you can work on it

  • Returning Oracle Output Parameters from Stored Procedures

    Hi,
    Please forgive my ignorance of Oracle and PL/SQL. I'm trying to get a value out of a stored proc which I've written. The proc takes a username input parameter and returns a user guid through an output parameter. I'm able to print the output parameter to the DBMS Output but can't figure out how to return the thing in a record when calling the proc through a normal sql prompt!
    My call is like so:
    DECLARE
    nGUID NVARCHAR2(255);
    BEGIN
    GETUSER(nGUID, 'WHY-DEV-QSYS-Tim Watson');
    DBMS_OUTPUT.PUT_LINE (nGUID);
    Would like to return the value here; what's the syntax?
    END;
    The signature of the proc is
    CREATE OR REPLACE PROCEDURE GETUSER
    USERGUID OUT NVARCHAR2,
    UNAME IN NVARCHAR2
    IS
    Can anyone assist?
    Thanks in advance!
    Tim

    The easiest way, in my opinion, is to not write a procedure, but a function for this porpose. You would not have to declare an out parameter, but a return value:
    CREATE OR REPLACE FUNCTION GETUSER
    UNAME IN NVARCHAR2
    return nvarchar2
    IS
    From SQL prompt, you can then do
    SQL> select getuser(<input_string>) from dual;
    and get the returnvalue.
    Best regards,
    Gerd

  • Multiples value from stored Procedure

    Hi all,
    I have a table with this structure.
    ID Startdate EndDate
    Now I want to retrive the row rows with time difference is >x , where the x has to passed as parameter.
    How can I do this one ?
    thanks in advance

    Are you date values stored as date or timestamps? It will make a difference. I'm not sure on these, but I'm new to Oracle as well. Give them a shot.
    With a date:
    where (Startdate - EndDate) > x OR (EndDate-StartDate) > x
    With a Timestamp:
    where Startdate>(EndDate-x) OR EndDate>(StartDate-x);

  • Unable to retrieve the values from stored procedure

    Hi all
    I written one procedure and when i am trying to invoke that store procedure from jdbc it is throwing the following error .
    java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.DelegatingCallableStat
    ement
            at com.srit.hrnet.helpdesk.grievancemechanism.GrievanceComplaintDAO.getE
    mployerGenDetails(GrievanceComplaintDAO.java:895)
            at com.srit.hrnet.helpdesk.grievancemechanism.GrievanceComplaintAction.d
    eleteComplaints(GrievanceComplaintAction.java:1095)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchActio
    n.java:276)
            at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:
    196)
            at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
    tProcessor.java:421)
            at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
    va:226)
            at org.apache.struts.action.ActionServlet.process(ActionServlet.java:116
    4)
            at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:252)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:173)
            at com.srit.hrnet.filter.SessionValidateFilter.doFilter(SessionValidateF
    ilter.java:79)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:173)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:213)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:178)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:126)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:105)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:107)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
    a:148)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
    :856)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
    ssConnection(Http11Protocol.java:744)
            at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
    int.java:527)
            at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
    lowerWorkerThread.java:80)
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
    ool.java:684)
            at java.lang.Thread.run(Unknown Source)
    java.lang.NullPointerException
            at com.srit.hrnet.helpdesk.grievancemechanism.GrievanceComplaintAction.d
    eleteComplaints(GrievanceComplaintAction.java:1098)and my code is
    store procedure is
    ============
    create or replace procedure SP_HD_GRIEVANCE_DELETE_DETAILS(in_queryid IN number DEFAULT NULL,RC1      IN OUT globalPkg.RCT1)
    as
    queryId number(18,0);
    BEGIN
    SP_HD_GRIEVANCE_DELETE_DETAILS.queryId := SP_HD_GRIEVANCE_DELETE_DETAILS.in_queryid;
      IF  SP_HD_GRIEVANCE_DELETE_DETAILS.queryId  = 1 THEN
             BEGIN
             OPEN RC1 FOR
            select HGRMCODE as compcode,emcode as applyEmpId,EMFNAME as assName,designame as desig,deptname as department ,to_char(HGRMOCCRDT,'DD/MM/YYYY') as occdate,
                        HGRMSLATYPE as category,HGRMSUBCAT as subcat,HGRMSLAPRIORITY as priority,HGRMSTATUS  as status from EMP_MSTR,HD_GRIEVANCE_RM_MSTR,
                        dept_mstr,desig_mstr where EMCODE=HGRMAPPLYEMCODE and EMDEPTCODE=deptcode and desigcode=EMDESIGCODE order by HGRMCODE;
            END;
         END IF;
    END SP_HD_GRIEVANCE_DELETE_DETAILS;and javacode is
    ==========
    con = new DBConnection().getConnection();
    java.sql.CallableStatement stmt = con.prepareCall("{call SP_HD_GRIEVANCE_DELETE_DETAILS(?,?)}");
                        stmt.clearParameters();
                        stmt.setInt(1,1);
                        stmt.registerOutParameter(2, OracleTypes.CURSOR);
                        stmt.execute();
                        cursor = ((OracleCallableStatement)stmt).getCursor(1);
    list  = new ArrayList();
                        while (cursor.next()) {
    compTO = new GrievanceComplaintTO();
    list.add(compTO);
    }where GrievanceComplaintTO is formbean class
    Please Guide me.
    Thanks in advance.

    Obviously, this
    cursor = ((OracleCallableStatement)stmt).getCursor(1);fails because you don't get an OracleCallableStatement.

  • Multiple Values from Stored Procedure

    Hello all,
    I have oracle table with 9 fields like startdate,enddate,name,id etc.
    Now from this table I want to to some manipulation like if if the startdate>enddate,if true return end date
    with
    StartDate,EndDate,CalculateEndDate,Name fields.
    I need this to be done all the rows in the table and return the result . What method I can for this
    I am using .Net as my Front End
    Thanks in advance

    My select is too complex to be returned in one Cursor.
    I have declared my own type
    TYPE myTableType AS TABLE OF myType;
    and
    TYPE myType AS OBJECT
    ( a NUMBER,b NUMBER,c VARCHAR2(5),d VARCHAR2(50) )
    Procedure p (inputpar IN VARCHAR2, Cur REF CURSOR);
    code
    LOOP
    .. code ..
    myData.EXTEND;
    myData(myData.COUNT) :=                     myType( variable1, var2, var3, var4);
    END LOOP;
    And at last returning a refcursor
    OPEN Cur FOR
    SELECT a,b,c..     
    FROM TABLE (CAST (myData AS myTableType));
    Lars Petersen

  • How to get BOOLEAN from STORED FUNCTION

    We are calling legacy PLSQL stored procedures and functions via named queries. This has worked fine so far, but there are some functions which return the type 'BOOLEAN'. e.g.
    FUNCTION some_function( some_argument IN NUMBER) RETURN BOOLEAN;
    Where the return type is BOOLEAN calling the named query fails with
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 13:
    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Error Code: 6550
    A couple of threads have hinted that what we are trying to do is not possible:
    How to get BOOLEAN from STORED PROCEDURES
    Re: Creating Named Query: from OracleCallableStatement
    This would possibly be due to 'restriction in the OCI layer'. Can anyone help? Is there really now way to call a valid PLSQL stored function via a named query when the return type is BOOLEAN?
    thanks

    I can't comment on possible issues you might have with the driver, but if it can be done in JDBC, it should be possible in TopLink.
    TopLink has the StoredFunctionCall which extends the StoredProcedureCall but adds an unnamed ouput parameter in the first spot of its parameter list. You will need to get the databasefield and set its type to BOOLEAN ie:
      DatabaseField returnField = (DatabaseField)yourStoredFunctionCall.getParameters().firstElement();
            returnField.setName(name);
            returnField.setSqlType(Type.BOOLEAN);Be sure not to use the setType() method, as I believe TopLink will try to use the Type.BIT when a boolean class is used as the classtype.
    Best Regards,
    Chris

Maybe you are looking for