Return type for a PL?SQL function

Hi,
I am trying to register a PL/SQL function with discoverer which returns more than one numerical values. What return type should i use for this function....cant see an array or something like it from the Diccover end, when I try to register it.
Please help.
-S

S.
If you create a function, then you can pass in parameters but only return one value for the function.
That return datatype cannot be an array, but just one value (ie: varchar, number, etc.).
Russ

Similar Messages

  • Complex return type for operations in Application Services

    Hi all,
    I am trying to create a complex return type for one of operation in CAF Application service.I have created a complex dataStructure  named productList and added product bussiness object as its attribute with cardinality 0--n. And used product dataType as my return type.
    But I am not getting any output but its work fine with cardinality 0--1.
    I am using CE 7.1 SP5 trial version.......
    Can anyone

    Hi,
    And used product dataType as my return type.
    Are you sure you did not forgot to change you operations return type to "productList"?
    Best regards
    Philipp

  • Using return value of a pl/sql function in the "where" coarse in a

    Hi,
    I have a question,
    if I have a pl/sql function that returns a boolean value, how can I use
    it directly in a select statement?
    I can easily do this if the function returns a number value , e.g.
    select * from my_table where my_package.function('abc') = 1;
    But I can't figure out how to do this if the function return a boolean.
    Any idea other than creating another function?
    Please reply to me directly as I'm not in the email list. Thanks.

    BOOLEAN is not a SQL datatype - you can only reference Boolean values in PL/SQL.

  • Non-void return type for Application Module Clients Interface

    Hello, can anyone guide me on how will I solve my problem.
    first of all, I'm using JDeveloper 10.1.3, I use JSF, ADF Faces, ADF Model, ADF Business Components.
    I made a web page that has a Transactional Capabilities, all is going smoothly, all data's can be saved to oracle database. I created a Custom Method in my Application Module and can be used in Clients Interface, that method is for saving data's to database.
    My problem is I dont know how to create a custom method that returns a value in my Application Module. Which means if I set it to non-void return type, it is not visible to Client Interface. If you're going to ask me why I need it to return a value? Well since that method is for saving data's, if there's an Error Occured, I can return the Error Message and show it to my user interface.
    Please help. thanks

    If you want to return your own type then simply define it as serializable and you will find that it will appear in the Client Interface dialog of your AM.
    eg, you could return this type from your application module to progagate a meaningful message to your UI:
    package com.delexian.model;
    import java.io.Serializable;
    public class MyMessage implements Serializable {
        private String _severity;
        private String _message;
        public MyMessage() {
        public void setSeverity(String severity) {
            this._severity = severity;
        public String getSeverity() {
            return _severity;
        public void setMessage(String message) {
            this._message = message;
        public String getMessage() {
            return _message;
    }regards,
    Brenden

  • ORA-12154: TNS:could not ... for imported pl-sql function in Process Flow

    Hi
    I included in a process flow a PL-SQL function as user defined transformation.
    This PL-SQL function resides in my source database, from where I imported it in OWB.
    When I am trying the run the Process Flow (from control center manager) I get the following message upon executing that function.
    ORA-12154: TNS:could not resolve the connect identifier specified
    When I don't include that function my process flow works. Mappings in my process flow read from the same source database as where the function is.
    So I don't think it is caused by a problem with tnsnames.ora..
    Thanks in advance for anybodies help.
    Hans

    Hi Oleg,
    Thanks for your reply. Indeed I didn't create a runtime repository.
    However don't like to do that to for the source DB.
    I wonder if I can get around that by executing a SQLplus script instead.
    I tried this but my script does never complete when it is started from the process flow. If I run it in SQLplus it runs fine and completes instantly.
    My script does:
    update 1 column in one record of a table.
    commit;
    exit;
    What do you think?
    Thanks,
    Hans

  • Return type for count queries

    Hello,
    My entity manager executes a native query for a count(*) operation to get the row count from a table. But I am confused to see that while executing I get different datatypes such BigInteger, BigDecimal etc on different runs of the same query. Why is this so?
    What is the deciding factor for count queries data type??
    Please help....

    The whole point of a constructor is to create an object on the heap and return a reference to that memory block. In fact the call to the constructor will return a reference to the instantiated object. Thus there is no point in specifying a return type to a constructor.
    If you think about the way we call the constructor then it's obvious that it's not a regular method which goes inside an object.
    Hope this will do what you want :)

  • What is the default return type for a constructor

    I tried and found out that it should not be void, what is it? I am confused. Any clue? thanks

    constructors do not have return types. it is implicit that it is initializing a newly created object of the class of which it is a member.
    --p                                                                                                                                                                                                                                                                                               

  • Best way to handle Interface Return Type for Web Service Method

    Hi All,
    i have the followinig situation. I would like to create a method as a web service:
    Customer getCustomer(someType){....}
    ie: getCustomer method, with a parameter that indicates some backend data source. The method returns a Customer object. However, depending on the datasource this method uses (which is dependent on the type passed in, ie FooDB, BarDB etc) then i return either a:
    FooCustomer extends AbstractCustomer implements Customer
    BarCustomer extends AbstractCustomer implements Customer
    Now this fails because JAXB cant handle interfaces because when sending XML over the wire it needs a concrete representation (as far as i understand).
    So how should i deal with this?
    Do I need to create a differnet method for each datasource (foo DB, bar DB), ie:
    FooCustomer getFooCustomer()
    BarCustomer getBarCustomer()
    or do i continue calling getCustomer but somehow indicate in the WSDL that I have an AbstractCustomer object and some other bits from FooCusotmer or BarCustomer or ....
    kinda stumpeed here? I wouldve thought itd be handy to be able to do this (ie: call one getCustomer() method and get back Customer objects representing nay type of customer ... in some way...but cant see how to achieve this.
    Any pointers would be greatly appreciated
    cheers
    Marty

    Try to explore abstract schema type.

  • Return values for WebEngine's ExecuteScript function?

    Hey guys and gals,
    I'm trying to write some code to load a webpage and get some values from the POST header, but unfortunately I'm having trouble with the basics.
    I can't get the executeScript function to return a JSObject! I'm having no luck finding what the executeScript function decides to return based on input. Every time I run the Java code, executeScript returns me the value of the POSTresponses variable as a String. Or it return
    Any suggestions of what could be happening?
    Error message:
    "java.lang.ClassCastException: java.lang.String cannot be cast to netscape.javascript.JSObject"
    Portion of Java file:
    public void changed(ObservableValue ov, State oldState, State newState) {
           Document document;
                                JSObject returnObject;
                                if(newState == State.SUCCEEDED) {
                                    document = webEngine.getDocument();
                                    if(document != null) {
                                        returnObject = (JSObject)webEngine.executeScript(receivedPostJs);
    Entire Javascript file:
    function getPostResponses() {
        var requestHandler = new XMLHttpRequest();
        var POSTresponses;
        if (requestHandler.readyState == 0) {
            POSTresponses = "Nada";
        } else if (requestHandler.readyState == 1) {
            POSTresponses = "Still nuthin";
        } else if (requestHandler.readyState == 2) {
            POSTresponses = requestHandler.getAllResponseHeaders();

    HI,
    I think one good approach could be generate a table API to perform the tasks that you want (insertion, select, update, delete) and put all of these procedures in a package. Each procedure has a return code (0 if succesful for example or the SQLCODE) and a message of the result of the operation ('Success' or the SQLERRM).
    Regards,

  • Return value for Direct OBPM SQL Query in OBPM 10GR3

    Hi all,
    I use a direct SQL Query provided by OBPM 10GR3 in my automatic activity to select certain elements from the db. The query is as follows:-
    foreach (element in
    SELECT id FROM TESTTABLE WHERE requestId = 732 and status = 1 )
    // statements
    logMessage("-- The id is-->" +element.id);
    This only returns when the id is found in the db but returns nothing when not found in db?
    How can I always get a return value? atleast a true or false, so that I can put IF statements?
    Because if it returns nothing, the loop does not execute {}? So we cannot put something like:-
    foreach (element in
    SELECT id FROM TESTTABLE WHERE requestId = 732 and status = 1 )
    logMessage("-- The id is-->" +element.id);
    if(element.id == null)
    logMessage("-- Id Not Found -->" );
    else
    logMessage("-- Id Found -->");
    How can I always get a return value from my OBPM direct query ?
    Remember , I am not using DynamicSQL in this case?

    Hi,
    Set a Boolean flag value to False before the SQL query.
    Some thing like:
    boolean flag = false;
    foreach (element in
    SELECT id FROM TESTTABLE WHERE requestId = 732 and status = 1 )
    logMessage("-- The id is-->" +element.id);
    flag = true;
    if(flag) {
    logMessage("-- Id Found -->" );
    else
    logMessage("-- Id Not Found -->");
    Hope the above logic would work fine.
    Bibhu
    Edited by: Bibhuti Bhusan on Sep 2, 2011 11:48 AM

  • Error: No return type for constructor?

    import java.swing.*;
    public class firstWindow extends JFrame
         public static final int WIDTH = 300;
         public static final int HEIGHT = 200;
         public FirstWindow()
              super();
              setSize(WIDTH,HEIGHT);
              JLabel newLabel = new JLabel("My Medical Record.");
              getContentPane().add(newLabel);
              WindowDestroyer listener = new WindowDestroyer();
              addWindowListener(listener);
    }I figure this is a syntax error but can't see it. WindowsDestroyer class below
    import java.awt.*;
    import java.awt.event.*;
         comments for window destroyer class
    public class WindowDestroyer extends WindowAdapter
         public void windowClosing(WindowEvent e)
              System.exit(0);
    }

    Hi,
    I just got back into town and saw all the heartfelt response. Thanks.
    I have no idea why I reposted this. It's not my norm and in no way was I trying to scrape out an answer. But I did it and I take the hit for it. I really apologize for that.
    The error was basic, but it's where I'm freaking AT. Basic. Go back to your initial steps into your FIRST programming language and review all the clumsy errors you made. I'm sure I'm going to make a few more thousand before I'm through.
    Java's error messages and syntax may seem very familiar to you but it's brand new to me. Many of the error messages and syntax aren't always clear, at least initially.
    From the ignorant knob butthole
    Edited by: Zarnon on Mar 13, 2008 7:13 AM
    Edited by: Zarnon on Mar 13, 2008 7:21 AM
    Edited by: Zarnon on Mar 13, 2008 7:23 AM

  • Return type Boolean From Oracle Function

    1. How do I get a return type of Boolean from Oracle function in Java?
    2. I have a function fx overloaded in Oracle (8 variances) and I have trouble getting the right one in Java. Is 8 too high a figure or Java does not support calling overloaded functions or what?
    Thanks for any help.

    I am facing a similar situation, where I have defined an overloaded function in one package (2 variants) which both return a type BOOLAN value.
    I am having trouble to setting up an CallableStatemnt to call one of this functions from Java. Whenever I set the parameter with a BIT or NUMBER data type, I get an exception with java.lang.boolean during my
    callablestatement.setobject( indez, parameter, OracleTypes.BIT );
    or
    callablestatement.setobject( indez, parameter, OracleTypes.NUMBER );
    I have no problem calling the function from SQLPlus, but doing so from Java raises the exception. I have found no exact match in OracleTypes or java.sql.Types for a BOOLEAN data type.
    In your response do you mean to modify the Function to return a NUMBER instead of a BOOLEAN, or do you mean to set the parameter as Types.NUMBER in the calling java code?
    Thanks,
    Fedro

  • Unable to retreive the return value of pl/sql function using DB Adapter

    Dear Experts,
    I am using DB Adapter in my BPEL Process. Using DB Adapter I am invoking a PL / SQL function. I am able to send two input parameters for the pl/sql function. But I dont know how to retrieve the return value from the function. Please suggest me.
    Thanks,
    Rajesh

    Yes I am returning a value from PL/SQL function.
    Please see the code segments below,
    FUNCTION "TD_INSERT" (a TDINIT_TYPE, stops TDDETAIL_TABLE )
    RETURN VARCHAR2
    AS
    td_no Number;
    td_id Number;
    stop TDDETAILFULL_TYPE;
    length number;
    BEGIN
    insert into TD_INIT values( ----passing all the values here --------- );
    select max(tdno) into td_no from TD_INIT ;
    length := stops.count;
    for i in 1.. length loop
    stop := stops(i);
    insert into TD_DETAIL_FULL values(
    td_no, ------- );
    end loop;
    commit;
    RETURN td_no;
    END;
    Thanks,
    Rajesh

  • Using PL/SQL Function with CLOB types and a Java Source

    Hi people.
    I have some problems trying to use a function in pl/sql with a CLOB parameter to a java source function.
    Here is the problem: I have to read a TXT file and return a CLOB with the data of the file. The reading is done with a java source function.
    The problem is how to read the file without messing the content and return it to the pl/sql function?
    Another problem: If I pass a CLOB as a parameter to a pl/sql function and have to write the content to a file, how to do it without screwing the EOL chars and so?
    My code is:
    /******** PLSQL FUNCTIONS ********/
    function fn_gravaconteudoarquivo( pv_caminho in varchar2
    , pv_nomearquivo in varchar2
    , pc_conteudo in clob ) return varchar2 as language java
    name 'Importacao.gravaConteudoArquivo(java.lang.String, java.lang.String, oracle.sql.CLOB) return varchar2';
    function fn_lerconteudoarquivoclob( pv_caminho in varchar2
    , pv_nomearquivo in varchar2 ) return clob as language java
    name 'Importacao.lerArquivoClob(java.lang.String, java.lang.String) return clob';
    /******** JAVA SOURCE FUNCTIONS *********/
    public static String gravaConteudoArquivo(String caminho, String nomeArquivo, CLOB conteudo) {
    File file = new File(caminho, nomeArquivo);
    PrintWriter pwFile;
    String mensagem = "";
    StringBuffer sb = new StringBuffer();
    try {
    pwFile = new PrintWriter(new BufferedWriter(new FileWriter(file,true)));
    for (int i=0;i<=(conteudo.length()/32000);i++) {
    sb.append(conteudo.getSubString(conteudo.getLength()+1,32000));
    pwFile.println(sb.substring(0));
    pwFile.close();
    } catch (Exception ex) {
    mensagem = "Erro: "+ex;
    return mensagem;
    public static CLOB lerArquivoClob(String caminho, String nomeArquivo) throws SQLException {
    File file = new File(caminho, nomeArquivo);
    Connection conn;
    CLOB clob = null;
    String lineSep = System.getProperty("line.separator");
    StringBuffer sb = new StringBuffer();
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:csdesv", "csestoque", "liberada");
    clob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION);
    BufferedReader brFile = new BufferedReader(new FileReader(file.getPath()));
    while (brFile.ready()) {
    sb.append(brFile.readLine());
    sb.append(lineSep);
    clob.open(CLOB.MODE_READWRITE);
    clob.setString(clob.getLength()+1, sb.toString());
    clob.close();
    } catch (Exception ex) {
    ex.printStackTrace();
    return clob;
    Ah, just remembered... This will work as a JOB.... >.< ... So the connection aparently is at localhost.
    Thanks.

    No one? I really need this....

  • SQL, PL/SQL functions, and ORA-04091 table is mutating

    Dears,
    Recently a question came up in an Oracle French forum about an insert/select that is throwing ORA-04091: table xxxx is mutating, trigger/function may not see it error in 11g while the same insert/select was working very well in 10g. The original poster gave a scenario that is easily reproducible. I am wondering what database release is correct the one throwing the error(11g) or the other one accepting the insert/select(10g)?
    *10g*
    mhouri.world > select * from v$version;
    BANNER                                                                         
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi               
    PL/SQL Release 10.2.0.4.0 - Production                                         
    CORE     10.2.0.4.0     Production                                                     
    TNS for Solaris: Version 10.2.0.4.0 - Production                               
    NLSRTL Version 10.2.0.4.0 - Production                                         
    mhouri.world > create table t_read_consistency (id number, vc varchar2(15), primary key (id));
    Table created.
    mhouri.world > insert into
      2        t_read_consistency
      3      select
      4        rownum id,
      5        rpad('a',15,'a')
      6      from
      7        dual
      8      connect by
      9        level<=1000;
    1000 rows created.
    mhouri.world > commit;
    Commit complete.
    mhouri.world > create or replace function f_read_consistency return varchar2
      2       as
      3        lv_vc  t_read_consistency.vc%type;
      4       begin
      5         select trc.vc
      6         into lv_vc
      7          from t_read_consistency trc
      8         where trc.id = 70 ;
      9        return lv_vc;
    10     end f_read_consistency;
    11    /
    Function created.
    mhouri.world >insert into
      2        t_read_consistency (id, vc)
      3      select
      4         1001
      5        ,f_read_consistency
      6      from dual;
          ,f_read_consistency
    ERROR at line 5:
    ORA-04091: table MHOURI.T_READ_CONSISTENCY is mutating, trigger/function may not see it
    ORA-06512: at "MHOURI.F_READ_CONSISTENCY", line 5
    _11g_
    mohamed@mhouri> select * from v$version;
    BANNER                                                                         
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production         
    PL/SQL Release 11.2.0.1.0 - Production                                         
    CORE     11.2.0.1.0     Production                                                     
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production                        
    NLSRTL Version 11.2.0.1.0 - Production                                         
    mohamed@mhouri> create table t_read_consistency (id number, vc varchar2(15), primary key (id));
    Table created.
    mohamed@mhouri> insert into
      2    t_read_consistency
      3  select
      4    rownum id,
      5    rpad('a',15,'a')
      6  from
      7    dual
      8  connect by
      9    level<=1000;
    1000 rows created.
    mohamed@mhouri>  create or replace function f_read_consistency return varchar2
      2   as
      3    lv_vc  t_read_consistency.vc%type;
      4   begin
      5     select trc.vc
      6     into lv_vc
      7      from t_read_consistency trc
      8     where trc.id = 70 ;
      9    return lv_vc;
    10  end f_read_consistency;
    11  /
    Function created.
    mohamed@mhouri> insert into
      2    t_read_consistency (id, vc)
      3  select
      4     1001
      5    ,f_read_consistency
      6  from dual;
      ,f_read_consistency
    ERROR at line 5:
    ORA-04091: table MOHAMED.T_READ_CONSISTENCY is mutating, trigger/function may
    not see it
    ORA-06512: at "MOHAMED.F_READ_CONSISTENCY", line 5 So far so good. Same behaviour for both releases. But let's bring a small change to the PL/SQL function to be as close as the example given in the French Forum
    _10g where the select/insert was working without error_:
    mhouri.world > select * from v$version;
    BANNER                                                                         
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi               
    PL/SQL Release 10.2.0.4.0 - Production                                         
    CORE     10.2.0.4.0     Production                                                     
    TNS for Solaris: Version 10.2.0.4.0 - Production                               
    NLSRTL Version 10.2.0.4.0 - Production       
    mhouri.world > create type t_read_cs as object (id number,vc varchar2(15));
      2  /
    Type created.
    mhouri.world > create type t_read_cs_tab  as table of t_read_cs;
      2  /
    Type created.
    mhouri.world > create or replace function f_read_consistency_tab
      2  return t_read_cs_tab
      3    as
      4      lc_t_read_cs_tab t_read_cs_tab := t_read_cs_tab();
      5      j  binary_integer := 0;
      6    begin
      7        for x in (select
      8                      id,
      9                      vc
    10                   from  t_read_consistency trs
    11                  where trs.id <= 10
    12       ) loop
    13 
    14          j := j +1;
    15          lc_t_read_cs_tab.extend;
    16          lc_t_read_cs_tab(j) := t_read_cs(x.id, x.vc);
    17     end loop;
    18     RETURN lc_t_read_cs_tab;
    19   end f_read_consistency_tab;
    20  /
    Function created.
    mhouri.world > select count(1) from t_read_consistency;
      COUNT(1)                                                                                                             
          1000                                                                                                             
    mhouri.world > select count(1)
      2  from (select * from table(f_read_consistency_tab));
      COUNT(1)                                                                                                             
            10                                                                                                             
    mhouri.world > insert into t_read_consistency
      2         (id,vc)
      3      select id,vc
      4   from table(f_read_consistency_tab)
      5  ;
    10 rows created.
    mhouri.world > select count(1) from t_read_consistency;
      COUNT(1)                                                                                                             
          1010            
    _11g where the same insert/select is throwing an error:_
    mohamed@mhouri> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    mohamed@mhouri> create type t_read_cs as object (id number,vc varchar2(15));
      2  /
    Type created.
    mohamed@mhouri> create type t_read_cs_tab  as table of t_read_cs;
      2  /
    Type created.
    mohamed@mhouri> create or replace function f_read_consistency_tab
      2      return t_read_cs_tab
      3        as
      4          lc_t_read_cs_tab t_read_cs_tab := t_read_cs_tab();
      5          j  binary_integer := 0;
      6        begin
      7            for x in (select
      8                          id,
      9                          vc
    10                      from  t_read_consistency trs
    11                     where trs.id <= 10
    12          ) loop
    13 
    14            j := j +1;
    15             lc_t_read_cs_tab.extend;
    16             lc_t_read_cs_tab(j) := t_read_cs(x.id, x.vc);
    17        end loop;
    18        RETURN lc_t_read_cs_tab;
    19      end f_read_consistency_tab;
    20    /
    Function created.
    mohamed@mhouri> select count(1) from t_read_consistency;
      COUNT(1)                                                                     
          1000                                                                     
    mohamed@mhouri> select count(1) from (select * from table(f_read_consistency_tab));
      COUNT(1)                                                                     
            10                                                                     
    mohamed@mhouri> insert into t_read_consistency
      2            (id,vc)
      3          select id,vc
      4      from table(f_read_consistency_tab)
      5     ;
        from table(f_read_consistency_tab)
    ERROR at line 4:
    ORA-04091: table MOHAMED.T_READ_CONSISTENCY is mutating, trigger/function may
    not see it
    ORA-06512: at "MOHAMED.F_READ_CONSISTENCY_TAB", line 7 In addition, one of the posters spotted out very judiciously that if we slightly change the definition of the table t_read_consistency in 11g, strangely the insert/select will work correctly in this data base as shown below:
    ohamed@mhouri> drop table tr_read_consistency;
    Table dropped.
    mohamed@mhouri> create table tr_read_consistency
      2      as select rownum rn,
      3                trs.*
      4      from
      5         t_read_consistency trs;
    Table created.
    mohamed@mhouri> insert into tr_read_consistency
      2                 (rn, id,vc)
      3              select rownum, id,vc
      4           from table(f_read_consistency_tab);
    10 rows created.So is this a regression? or a corrected bug during upgrade?
    Thanks in advance
    Mohamed Houri

    I just followed the doc links provided by Tubby, which have 100% Correct answer. See below :
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> show user;
    USER is "SCOTT"
    SQL> create type t_read_cs as object (id number,vc varchar2(15));
      2  /
    Type created.
    SQL> create type t_read_cs_tab  as table of t_read_cs;
      2  /
    Type created.
    SQL> create table t_read_consistency (id number, vc varchar2(15), primary key (id));
    Table created.
    SQL> create or replace function f_read_consistency_tab
      2  return t_read_cs_tab
      3  as
      4  lc_t_read_cs_tab t_read_cs_tab := t_read_cs_tab();
      5  j  binary_integer := 0;
      6  begin
      7  for x in (select
      8  id,
      9  vc
    10  from  t_read_consistency trs
    11  where trs.id <= 10
    12  ) loop
    13  j := j +1;
    14  lc_t_read_cs_tab.extend;
    15  lc_t_read_cs_tab(j) := t_read_cs(x.id, x.vc);
    16  end loop;
    17  RETURN lc_t_read_cs_tab;
    18  end f_read_consistency_tab;
    19  /
    Function created.
    SQL> insert into
      2  t_read_consistency
      3  select
      4  rownum id,
      5  rpad('a',15,'a')
      6  from
      7  dual
      8  connect by
      9  level<=1000;
    1000 rows created.
    SQL> select count(1) from t_read_consistency;
      COUNT(1)
          1000
    SQL> select count(1) from (select * from table(f_read_consistency_tab));
      COUNT(1)
            10
    SQL> insert into t_read_consistency
      2  (id,vc)
      3  select id,vc
      4  from table(f_read_consistency_tab);
    from table(f_read_consistency_tab)
    ERROR at line 4:
    ORA-04091: table SCOTT.T_READ_CONSISTENCY is mutating, trigger/function may not see it
    ORA-06512: at "SCOTT.F_READ_CONSISTENCY_TAB", line 7
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace function f_read_consistency_tab
      2  return t_read_cs_tab
      3  as
      4  lc_t_read_cs_tab t_read_cs_tab := t_read_cs_tab();
      5  j  binary_integer := 0;
      6  PRAGMA AUTONOMOUS_TRANSACTION; <--- This works as documented in 11.2.0.1
      7  begin
      8  for x in (select
      9  id,
    10  vc
    11  from  t_read_consistency trs
    12  where trs.id <= 10
    13  ) loop
    14  j := j +1;
    15  lc_t_read_cs_tab.extend;
    16  lc_t_read_cs_tab(j) := t_read_cs(x.id, x.vc);
    17  end loop;
    18  RETURN lc_t_read_cs_tab;
    19* end f_read_consistency_tab;
    SQL> /
    Function created.
    SQL> insert into t_read_consistency
      2  (id,vc)
      3  select id,vc
      4  from table(f_read_consistency_tab);
    insert into t_read_consistency
    ERROR at line 1:
    ORA-00001: unique constraint (SCOTT.SYS_C0011307) violated
    SQL> drop table t_read_consistency purge;
    Table dropped.
    SQL> create table t_read_consistency (id number, vc varchar2(15));
    Table created.
    SQL> insert into
      2  t_read_consistency
      3  select
      4  rownum id,
      5  rpad('a',15,'a')
      6  from
      7  dual
      8  connect by
      9  level<=1000;
    1000 rows created.
    SQL> commit;
    Commit complete.
    SQL> insert into t_read_consistency
      2  (id,vc)
      3  select id,vc
      4  from table(f_read_consistency_tab);
    10 rows created.
    SQL> commit;
    Commit complete.
    SQL>So, you have to add only PRAGMA AUTONOMOUS_TRANSACTION; before begin in your function code to avoid ORA-04091 in 11.2.0.1
    But, All thanks to Tubby who pointed us to the correct documentation link.
    Regards
    Girish Sharma

Maybe you are looking for

  • WD external hard drive seems to crash my Mac just by being connected to it

    Is this even possible? I apologize in advance if the question is too obviously n00b, or if it's been answered (I did search before posting), or if it's in the wrong forum. I have a brand-new MBP, late 2008, and I was going to use a WD Elements 1.5 TB

  • [SOLVED] Is full UTF-8 supported in unicode-rxvt?

    Does urxvt have full UTF-8 support, or it only supports 16 bit unicode characters? I have set inconsolata font for URXVT adding to .Xdefaults this line: URxvt*font: xft: Inconsolata:pixelsize=17:antialias=True:hinting=True I can write most characters

  • Not updating but iTunes sais different

    Hello, Im heading on a big trip tomorrow so I wanted to update my iPod. So when I go to do so everything looks normal, when I try to delete some video's and add others iTunes claims it has. However, when I disconnect my iPod nothing has changed. It's

  • Titles look washed out

    I have ended a video with simple credits: white Gill Sans lettering on a black background. These titles show on the computer as crisply and vividly as I had intended. When I create a DVD and play it on the computer, they are still crisp white-on-blac

  • 2009 MacBook Pro is slow now. Ran EtreCheck. Need help.

    Problem description: Slow macbook. Fans run almost all the time even with just a web browser open. EtreCheck version: 2.1.2 (105) Report generated December 12, 2014 at 1:51:59 AM CST Hardware Information: ℹ️   MacBook Pro (13-inch, Mid 2009) (Verifie