Looking for an example of "function that returns the error text.

Environment: APEX 3.1.1.00.09 on AIX 5.3

I'm looking for an example implementation of the posting of the "function that returns the error text.

I would like to write a database function that does the validation logic and return the text of the error.

Is it possible to create multiple lines of text of error based on error conditions?

I'm trying to use it at the end of the input data to go on the set of the 'document' to the entry and highlight all error conditions encountered before the 'document' is subject to additional processing.

I wrote the function and reference it in a posting as ' validate_stuff (: P3_DOC_SEQ); »

I have an error message "validate_stuff is not a procedure or is not defined.

The object is a function, not a procedure. It is defined to return a parameter VARCHAR2 hoped posting if it is not NULL.

When I run the SQL function * more and spend in a number of documents are returned the correct error messages.

Any direction is greatly appreciated.

-gary

Hi Gary,.

You must RETURN the result of the function:

BEGIN
 RETURN validate_stuff(:P3_DOC_SEQ);
END;

Andy

Tags: Database

Similar Questions

  • Function that return the name of the current report

    Hello

    Anyone know if there is a function that returns the name of the current report?, similar to GET_APPLICATION_PROPERTY (CURRENT_FORM) in the forms.


    Tnks,


    LEFM

    Hello

    You can use the builtin: SRW. GET_REPORT_NAME
    This function returns the file name of the running report

    http://www.Oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/PLSQL/builtins/SRW/srw_get_report_name.htm

    NOTE: it is not the name of the RDF file. Is the name defined in the reporting name property.

    Concerning

  • function to_numer returns the error in pl/sql

    Hello
    I don't have a prob when executing select double to_number('1234.56'), the numer contains decimal numbers
    But this stm return number not valid error in the procedure, except if I use to_number('1234.56','9999999.99')
    Please help me.
    I need to set parameter in DB?
    BTW: my NLS_NUMERIC_CHARACTER has the value '.,'
    Thank you.

    function to_numer returns the error in pl/sql

    hlthanh wrote:
    Hello
    I don't have a prob when executing select double to_number('1234.56'), the numer contains decimal numbers
    But this stm return number not valid error in the procedure, except if I use to_number('1234.56','9999999.99')
    Please help me.
    I need to set parameter in DB?
    BTW: my NLS_NUMERIC_CHARACTER has the value '.,'
    Thank you.

    Handle: hlthanh
    Status level: Beginner
    Join date: March 7, 1999
    Messages total: 94
    Total Questions: 60 (38 pending)
    many questions and so few answers.
    How SAD!

  • Request report - use the function that returns the cursor

    My requirement is to create a report, which the source will be a function that returns a cursor (the type of cursor is ref cursor).
    How this can be done?

    for example. function my_func (pol_no in number) return cur_type < ref cursor >

    Edited by: viveks on October 27, 2009 10:09

    Better to look at a function that returns a query, or use a hose to treat your cursor returned, because the APEX at the moment can NOT handle the sliders in reports...

    Thank you

    Tony Miller
    Webster, TX

  • a function that returns the type with a table joint!

    Good day to all,
    I have a function that returns a type.

    so I select it as:
    Select * from table (function (param1, param2))

    now I want to combine this with a table so that the settings for the service we get from the join table. Is this possible? And how?
    I tried different options without success.

    something like:
    Select *.
    table table (function (b.column1, b.columnb) x), tablea b
    where x.a = b.col

    Is this possible?

    Thanks in advance?

    user564819 wrote:

    something like:
    Select *.
    table table (function (b.column1, b.columnb) x), tablea b
    where x.a = b.col

    Is this possible?

    Somehow...

    SQL> create or replace type TIntegers is table of integer;
      2  /
    
    Type created.
    
    SQL>
    SQL> --// our sample pipeline simply spews 2 numbers for eevry number input - simple
    SQL> --// to use for the testcase below
    SQL> create or replace function FooPipe( n number ) return TIntegers pipelined is
      2  begin
      3          pipe row( trunc(n) );
      4          pipe row( trunc(n)*-1 );
      5          return;
      6  end;
      7  /
    
    Function created.
    
    SQL>
    SQL> with dataset( n ) as(
      2          --// ignore this part as it only builts a base table
      3          --// for us to use to select values for input to
      4          --// to the pipeline - in "real world" use this table
      5          --// will already exist
      6          select
      7                  level
      8          from    dual
      9          connect by level <= 10
     10  ),
     11  pipe_line( n, array ) as(
     12          --// we run the pipeline as a nested table column
     13          --// in the SQL projection - the CAST is important
     14          --// in order to establish the nested table type
     15          select
     16                  d.n,
     17                  cast(
     18                          FooPipe(d.n) as TIntegers
     19                  )
     20          from    dataset d
     21  )
     22  --// we now use a standard query to unnest the nested table column
     23  select
     24          p.n,
     25          pipe_val.*
     26  from       pipe_line p, TABLE(p.array)  pipe_val
     27  /
    
             N COLUMN_VALUE
    ---------- ------------
             1            1
             1           -1
             2            2
             2           -2
             3            3
             3           -3
             4            4
             4           -4
             5            5
             5           -5
             6            6
             6           -6
             7            7
             7           -7
             8            8
             8           -8
             9            9
             9           -9
            10           10
            10          -10
    
    20 rows selected.
    
    SQL>
    

    Not sure I like it. What is the real problem that this method (driving a pipeline with input of a base table rows) is supposed to address? There may be a simpler and more elegant approach...

  • VALIDATION - function returns the error text

    I have a domain that occurs on about 12 pages, I need to post this field with some code

    I created a function on the database that performs this validation, I pass the field value to the function and it returns some text of error, or NULL if the value is correct

    I can't for the life of figure me out how to call the function of APEX

    I've tried everything

    FUNCTION RETURN ERROR TEXT, Expression SQL, PL/SQL Expression... nothing works!

    to call the function my comand is

    FN_VALIDATE_HR1_REF (: P1_GCI,: P1_HR1_REF);

    I want to return the error on the function text and display it in the banner of APEX error

    any help greatly appreciated

    A function like this return error text should work:

    Return (FN_VALIDATE_HR1_REF (: P1_GCI,: P1_HR1_REF));

    Is giving the error?

  • I'm looking for a sleep mode function that goes off after some time. I would like to limit the time that my teenager spend on the game

    I know how to use window 7 time limit control. BUT it does allow me to leave my teenager spend any time of the day only 2 hours. I'm looking for something like a standby mode. After that he connects to his side of the user of the computer, turning after 2 hours of play.

    (Moved from Gaming)

    Hi Stephanie,

    Thanks for posting your request here in the Microsoft Community.

    We have a feature called schedule a task, this will help you plan the task of putting the computer in Mode standby when you want the computer to access the Mode sleep. See the following Microsoft Help article to learn more about this feature.

    http://Windows.Microsoft.com/en-us/Windows/schedule-task#1TC=Windows-7

    For more information, you can consult the following Microsoft Help article.

    http://Windows.Microsoft.com/en-us/Windows7/sleep-and-hibernation-frequently-asked-questions

    Please reply with the status of the issue so that we can better help you.

  • Function that returns the text of the error - type of Validation

    Small question regarding creating a function that successfully compiles a validation without a text of the error control: what value the function returns to validation successful?

    I tried a null value, but it doesn't seem to work.

    Thank you.

    Hello

    How does it work?

    What return NULL validation function is passed. If it returns a character string, then the validation failed and string is displayed as the error message for validation

    BR, Jari

  • Function that returns the results of a select statement

    Hello

    I would like to create a feature on the famous HR Departments oracle table to select * from him. I don't know how to do it.

    Is someone can help me?.

    Thank you

    Oracle stored functions cannot return result sets directly but can return the REF CURSOR. Please read [optimize result set retrieval using ODP.NET and Ref Cursor | http://www.oracle.com/technology/pub/articles/mastering_dotnet_oracle/williams_refcursors.html] which gives complete examples in PL/SQL for the side Server and VB. NET client side.

  • Why the HTTP become function returns the error code 63?

    I tried to use the get HTTP function to get the XML file is returned by the api Google MAPS distance-matrix. I got the right answer if I insert the url directly in the browser, but using the get HTTP function, it returns the error 63, why?

    This is my code (the VI is developed on LV2011).

    I guess, the VI GET for use with LabVIEW Web Service, only not to get of the Internet pages.

    Using the simplest way:

    Andrey.

  • Looking for an example of a rule FMS to the process that matches LogFilter

    Hello

    am looking for an example of a rule that manages different LogFilter matches?

    I installed a handful of filter string matches a logfilter officer and was looking for an example rule that could read the Message string for the user and manage each matching filter separately.

    So, I would have 4 match of different styles in an agent instance filter a log and would manage each game separately.

    The only rule of type existing LogFilter I found on the system had what is stated below in the part of the rule Condition:

    checkObservationAlarms (#LogFilter_ErrorVerbose to 1ms #,)

    {the entry->

    If (entry.get ("Severity") == "WARNING") {}

    return 2;

    }

    If (entry.get ("Severity") == 'CRITICAL') {}

    return 3;

    }

    If (entry.get ("Severity") == "FATAL") {}

    return 4;

    }

    return 0;

    },

    {entry, severity-> {switch (severity)}

    case 2:

    return "" + entry.get ("LogName") + ":" + entry.get ("Error_Message") + ""; ""

    case 3:

    return "" + entry.get ("LogName") + ":" + entry.get ("Error_Message") + ""; ""

    case 4:

    return "" + entry.get ("LogName") + ":" + entry.get ("Error_Message") + ""; ""

    by default:

    Return ' ';

    }}, "542c111ff5feabe3803bccb722386cae") () .size > 0;

    ----

    But I don't know if I need to change it it seems to be some sort of standard boilerplate for this type of rule.

    I need to be able to key off the field to the user Message.  So even if I have 1 rule for each 4 journal of my agent logfilter properties filter models, it's ok.  I just need to understand how to do a test for the rule based on the user Message field values or extends its reach to this particular user Message string.

    I'll post a picture of the logfilter message strings.

    So I would look on the way to have a fair rule match the logfilter agent when the returned string is "ECG_Java_Memory_Error", then I would have another rule for each of the other models in the returned string.

    Looking for an example of a standard type.

    Thank you

    "mark".

    It is the major brand

    David Mendoza

    Foglight Consultant

  • Go to a function that returns a Boolean

    Short version of the question: Boolean values can be returned by a pl/sql function?

    I've implemented a short function which returns a Boolean value; When I compile it I get an error:

    Error report:

    ORA-06550: line 5, column 32:

    PLS-00382: expression is of the wrong type

    ORA-06550: line 6, column 4:

    PLS-00306: wrong number or types of arguments in the call to "PUT_LINE '.

    ORA-06550: line 6, column 4:

    PL/SQL: Statement ignored

    06550 00000 - "line %s, column % s:\n%s".

    * Cause: Usually a PL/SQL compilation error.

    * Action:

    The closest, I appealed


    RETURN sys.diutil.bool_to_int (< foo >);


    and then a caller script can call


    sys.diutil .int_to_bool (< bar >);

    at least this way there is no verification of the Boolean value of 'manual '.  Is it really the only way to return / call a Boolean?


    Thank you

    Chris


    EDIT


    I was aware of the fact I had not provided examples of code - and was just one question fairly open. I hope that this example will show what does not work!


    I have a function that returns a Boolean value:


    create or replace

    FUNCTION myFunc (s_in IN VARCHAR2) RETURN a Boolean value

    IS

    s_out BOOLEAN: = TRUE;

    BEGIN

    RETURN s_out;

    END FUNCTION3;

    I try and call the function in the following script:

    DECLARE

    s_in varchar2 (20): = "Hello";

    s_out boolean;

    BEGIN

    SELECT myfunction (s_in) INTO s_out FROM DUAL;

    END;

    That's when I get the error. But sorry, I was looking for too many error messages! I have worked that the one I posted above is because put_line can accept only strings and numbers not Boolean, the mistake that this function returns is:

    ORA-06550: line 5, column 32:

    PLS-00382: expression is of the wrong type

    ORA-06550: line 5, column 11:

    PLS-00382: expression is of the wrong type

    06550 00000 - "line %s, column % s:\n%s".

    * Cause: Usually a PL/SQL compilation error.

    * Action:

    However, I suppose that the comment of Frank Kulash is perhaps the reason why I see this?


    Post edited by: 2922851

    Hi, Chris,.

    2922851 wrote:

    Short version of the question: Boolean values can be returned by a pl/sql function?

    Sure.  If you are having problems, post your code (both the function and some PL/SQL that calls it).

    The BOOLEAN data type exists only in PL/SQL, not in SQL, so if the function returns a BOOLEAN value, then you can't call it in a SQL statement, even if this SQL statement is used within PL/SQL.  For this reason, a lot of guys write functions that return a NUMBER (1 or 0) or a string (' t ' or 'F') rather than return a BOOLEAN value.

    I've implemented a short function which returns a Boolean value; When I compile it I get an error:

    Error report:

    ORA-06550: line 5, column 32:

    PLS-00382: expression is of the wrong type

    ORA-06550: line 6, column 4:

    PLS-00306: wrong number or types of arguments in the call to "PUT_LINE '.

    ORA-06550: line 6, column 4:

    PL/SQL: Statement ignored

    06550 00000 - "line %s, column % s:\n%s".

    * Cause: Usually a PL/SQL compilation error.

    * Action:

    This error indicates a problem calling put_line; It has nothing to do with what returns the function.

  • How to expose a function that returns a XML as a Web Service?

    ---------------------------------------------------------------------------------
    Oracle Database 11 g Release 11.2.0.3.0 - 64 bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    "CORE 11.2.0.3.0 Production."
    AMT for 64-bit Windows: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    ---------------------------------------------------------------------------------

    After reviewing the documentation of oracle on the generation of xml data in the database, I managed to select normal tables and return a result xml exactly as I want:
    -- My types
    create or replace 
    TYPE CHILD_T AS OBJECT ("@ID" VARCHAR2(20), "@NAME" VARCHAR2(20));
    
    create or replace 
    TYPE CHILDREN_T AS TABLE OF CHILD_T;
    
    create or replace 
    TYPE PARENT_T AS OBJECT ("@ID" VARCHAR2(20), CHILDREN CHILDREN_T );
    
    -- The actual select
    SELECT XMLFOREST (
                PARENT_T(d.id,
                CAST ( MULTISET (SELECT c.id, c.name
                                 FROM child c
                                 WHERE c.parent_id = p.id) AS CHILDREN_T )
                ) AS "Parent"
            ) 
    FROM parent p;
    That gets me this:
    <Parent ID="1">
        <CHILDREN>
            <CHILD_T ID="1" NAME="xxxxx" />
            <CHILD_T ID="2" NAME="yyyyy" />
            <CHILD_T ID="3" NAME="zzzzz" />
        </CHILDREN>
    </Parent>
    It's perfect, but how to expose this result as a Web Service like this link?
     http://localhost:8080/orawsv/MY_USER/GET_CHILDREN?wsdl
    I tried this function:
    FUNCTION GET_CHILDREN (
        PARENT_ID IN VARCHAR2
    ) RETURN CLOB
    AS
        L_RESULT CLOB;
    BEGIN
        SELECT to_clob(XMLFOREST (
                PARENT_T (p.id,
                CAST ( MULTISET (SELECT c.id, c.name
                                 FROM child c
                                 WHERE c.parentId = p.id) AS CHILDREN_T )
                ) AS "ParentObj"
          )) AS MY_XML INTO L_RESULT
        FROM parent p
        WHERE p.i = PARENT_ID;
    
        RETURN (L_RESULT);
    END GET_CHILDREN;
    But when I access although .NET Compact Framework, I get this: "'Element' is an invalid XmlNodeType.

    As you can see, I just need a simple way to transport information between a Windows CE handheld computer and our database. Use functions that return simple values.
    Do I have to return the data as xml?
    What return value I should use? Varchar2 throws a buffer error output.

    ---------
    It is my first post here, also my first contact with OracleDB, and Web Services.

    Hello

    Welcome to Oracle and XML DB!

    After reviewing the documentation of oracle on the generation of xml data in the database, I managed to select normal tables and return a result xml exactly as I want:

    Have you also read about the SQL/XML functions?
    You don't have to create objects of type SQL to generate XML data.

    Using only XMLElement, XMLAgg, XMLAttributes, etc., you should be able to generate any kind of structure complex relational data and with total control over the names (which you don't have with the types of objects).
    Your example can be rewritten to:

    SELECT XMLElement("Parent",
             XMLAttributes(p.id as "Id")
           , XMLElement("Children",
               (
                 SELECT XMLAgg(
                          XMLElement("Child",
                            XMLAttributes(
                              c.id as "Id"
                            , c.name as "Name"
                            )
                          )
                        )
                 FROM child c
                 WHERE c.parent_id = p.id
               )
             )
           )
    FROM parent p
    WHERE p.id = :parent_id ;
    

    It's perfect, but how to expose this result as a Web Service like this link?
    [...]
    Do I have to return the data as xml?

    Yes.
    Define the return as XMLType data type:

    FUNCTION GET_CHILDREN (
        PARENT_ID IN VARCHAR2
    )
    RETURN XMLTYPE
    AS
        L_RESULT XMLTYPE;
    BEGIN
    
      SELECT XMLElement("Parent",
               XMLAttributes(p.id as "Id")
             , XMLElement("Children",
                 (
                   SELECT XMLAgg(
                            XMLElement("Child",
                              XMLAttributes(
                                c.id as "Id"
                              , c.name as "Name"
                              )
                            )
                          )
                   FROM child c
                   WHERE c.parent_id = p.id
                 )
               )
             )
      INTO L_RESULT
      FROM parent p
      WHERE p.id = PARENT_ID ;
    
      RETURN (L_RESULT);
    
    END GET_CHILDREN;
    
  • Function that returns only numbers

    Is it possible to have a SQL function that returns only numbers in a varchar?

    Example:

    My PHONE_NUMBER table contains a field with a phone number in VARCHAR2, it can contain:

    1-888-444-5555 or (514) 444-6666 or 514-222-4444 ext: 100


    I want to have a fuction which back me:

    18884445555 and 5144446666...


    Thanks for the help

    Hello

    For a copy of the string s with everything except the numbers (0-9), was deleted:

    REGEXP_REPLACE ( s
                   , '[^0-9]
                   )
    

    The expression above will work in Oracle 10 and higher.
    In any version, you can use TRANSLATE to remove the numbers, then reuse TRANSLATE to remove these characters from the s.

    TRANSLATE ( s,
           , '0' || TRANSLATE ( s
                                  , 'A0123456789'
                        , 'A'
                        )
           , '0'
           )
    
  • How to call a function that returns a SYS_REFCURSOR?

    Here's the situation.
    If I use ODP. NET to get a REF_CURSOR of a procedure in a package that it works without a hitch.

    If I use ODP .NET to run an Oracle function that returns a REF CURSOR, all sorts of things fool you.
    I use .NET 3.5 and ODP .NET version 2.112.1.2 (11 G). My Oracle database is 9.2.0.7.0

    There is this function returns a REF CURSOR.
    The code looks something like this.
    CREATE OR REPLACE FUNCTION SENDMEAREFCURSOR RETURN SYS_REFCURSOR IS
      X_REF genPkg.genericcursor;
    BEGIN
      OPEN X_REF for
        SELECT customer_id, name FROM CUSTOMERS;
      Return X_REF;
    END;
    .NET code looks like this. It's after a few adjustments.
            private static OracleDataReader FireMyFunc(OracleConnection oc)
            {
                try
                {
                    OracleCommand cmd = new OracleCommand();
                    cmd.Connection = oc;
                    //cmd.CommandText = "SELECT sendmearefcursor FROM DUAL";
                    //cmd.CommandType = System.Data.CommandType.Text;
                    cmd.CommandText = "sendmearefcursor";
                    cmd.CommandType = CommandType.StoredProcedure;
                    OracleParameter prm = cmd.CreateParameter();
                    prm.OracleDbType = OracleDbType.RefCursor;
                    prm.ParameterName = "returncurse";
                    prm.Direction = ParameterDirection.ReturnValue;
                    cmd.Parameters.Add(prm);
                    cmd.ExecuteNonQuery();
                    return (OracleDataReader) prm.Value; //Throws an UnableToCast exception.
                }
                catch (System.Exception ex)
                {
                   Console.WriteLine(String.Format("FireMyFunc: {0}",ex.ToString()));
                    throw;
                }
            }
    What should I do to get the refCursor?

    Hello

    You can use the GetDataReader of the OracleRefCursor object to return the datareader object.

    OracleRefCursor rc is prm (OracleRefCursor). Value;
    return of rc. GetDataReader();

    HTH
    Jenny

Maybe you are looking for