Field validation through pl/sql returning a Boolean

Hello

I do a validation of date entered based on a value in the other field of the form.  The function returns Boolean values (TRUE / FALES) based on the date of entry if it falls within the specific range of dates.

Here is the example.

img 2.png

However, after sending them, I get the error message like -.

Processing of validation error.

ORA-06550: line 1, column 44: PLS-00221: 'F_CHECK_DATE' is not a procedure or is undefined ORA-06550: line 1, column 44: PL/SQL: statement ignored

I'm doing something wrong here?  Help, please.

Thank you

-Anand

anand_gp wrote:

Hello

I do a validation of date entered based on a value in the other field of the form.  The function returns Boolean values (TRUE / FALES) based on the date of entry if it falls within the specific range of dates.

Here is the example.

However, after sending them, I get the error message like -.

Processing of validation error.

ORA-06550: line 1, column 44: PLS-00221: 'F_CHECK_DATE' is not a procedure or is undefined ORA-06550: line 1, column 44: PL/SQL: statement ignored

I'm doing something wrong here?  Help, please.

Thank you

-Anand

The index is in the validation type: function returning a Boolean

The expression of validation for validation of Boolean function return must be in the form of a function with at least one accessible body return statement that returns a Boolean value:

...

return ;

or

return to_date(:p11_event_date, 'DD/MM/YYYY') > sysdate;


in this case:

return my_package.f_check_date(:p11_season, :p11_event_date);

However, because the function returns a Boolean value anyway, you might as well use a validation Of PL/SQL Expression and save some typing:

my_package.f_check_date (: p11_season,: p11_event_date);

Tags: Database

Similar Questions

  • pl/sql returning a Boolean?

    I don't know what the problem with this code:
    declare
    
    l_return boolean ;
    
    begin
    if 1 =1 then l_return := TRUE ;
    end if;
    
    RETURN l_return ;
    
    end;
    as part of the State of the button = "function from pl/sql returning a Boolean"...
    It produces:
     
    ORA-06550: line 9, column 1:
    PLS-00372: In a procedure, RETURN statement cannot contain an expression
    ORA-06550: line 9, column 1:
    PL/SQL: Statement ignored
    
    7. end;

    Initialize the variable to FALSE;

    Boolean l_return: = false;

  • conditional view using body of the Pl/SQL function returning a Boolean

    I have problems with the conditional display of a report.

    I have to select list: p50_facility and p50_supervisor.

    I entered the Sub function body of pl/sql returning a Boolean

    Begin
    If (: p50_facility is null or)
    (: p50_supervisor is null) THEN
    Return False;
    On the other
    Return True;
    End if;
    End;

    No matter what values are my articles on (null, not null), the report shows.

    What I am doing wrong?

    Hello

    The list values will be null only until the first time that the page is sent. Subsequently, the value is likely to be "null %."

    You should do something like:

    BEGIN
     IF (:P50_FACILITY IS NULL OR :P50_FACILITY = '%' || 'null%' OR :P50_SUPERVISOR IS NULL OR :P50_SUPERVISOR = '%' || 'null%') THEN
      RETURN FALSE;
     ELSE
      RETURN TRUE;
     END IF;
    END;
    

    Andy

  • The page validation: function returning a Boolean

    Hi guys,.

    I'm doing a page validation simple to check an element in my presentation table if it is a number or not:

    START
    FOR i IN 1.. apex_application.g_f12. COUNTY
    LOOP
    IF LENGTH (TRIM (TRANSLATE (apex_application.g_f12 (i), "0123456789","" "))) is NOT null
    THEN
    RETURN FALSE;
    END IF;
    END LOOP;
    END;

    but I get this error message if g_f12 = AAA:

    ORA-06502: PL/SQL: digital or value error: character of number conversion error
    ERR-1021 error cannot run the validation of the "body of the function that returns a Boolean.
    Ok

    If g_f12 = A12 or a mixed alphanumeric it will work!

    * (I tried this with the function returning the text and it works like a charm, but in this case I have to use the function returns boolean to allow me to translate the error message) *.

    am I doing something wrong please help

    Thank you

    Hello

    Well, now when I look at the error message, I think that the problem is quite obvious.

    Kind regards
    Jari

    -----
    My Blog: http://dbswh.webhop.net/dbswh/f?p=BLOG:HOME:0
    Twitter: http://www.twitter.com/jariolai

  • Field validation tests

    Hi all

    I'm currently testing a telephone number for the validation field. I configured the validation settings, but I want to use exit the event to focus on the field if the entry does not. As you can see you can enter an invalid phone number and it pops up the error and then move to the next field.  I want to return to the Center.  This is the code I tried but I can not find the list of properties anywhere.  Can someone point me to the appropriate reference?

    What goods using the system sets to true or false as part of validation so that I could use (this.mysterypropertyIdontknow)

    In the example below, I made the property 'validated' to illustrate my point.

    Thanks in advance,

    Tony.

    event out of JavaScript:

    If (!) () xfa.host.setFocus (this.somExpression) This.Validated));

    Place a text field on the form.

    Validate the model: text 9999999999 {}

    Edit pattern: text {9999999999}

    View model: text {'('999') 999-9999}

    Copy the code to the below change event
    restrict entry to the numbers
    If (xfa.event.change.match(/[0-9]/) == null)
    XFA. Event.change = "";

    Copy the code to the Exit event below
    If (this.rawValue! = null & this.rawValue! = "") {}
    If (!) ((This.TST))) {}
    If the Validate event not executed, this.tst value happens as undefined, then force them to run the validate event
    If (this.) TST == undefined) {}
    this.execEvent ("validate");
    }
    else {}
    xfa.host.setFocus (this.somExpression);
    }
    }
    }

    Copy the code to validate the events below

    var strPhoneNumber = "" + this.rawValue;
    If (strPhoneNumber! = "" |) strPhoneNumber! = null) {}
    this.formatMessage = ' Please enter a valid phone number! "
    This.TST = false;
    }
    on the other
    This.TST = true;
    This.TST | Boolean (this.execEvent ("Exit"));
    }

    Thank you

    Srini

  • When I filled a form field using a query SQL result is displayed but not registered in the table.

    I write in the topic, I have created a form and in some of their fields, I used a SQL query to get information from a table based on the user who has been logging.

    The information displayed well, but when I press "Send button" loses information and the field in the table is shown empty.


    Anyone know what is happening?

    I enclose below a picture of the problem

    Concerning

    Problema DB APEX.jpg

    Hi ANTHONY,.

    ANTHONY wrote:

    I give you the credentials of my database, I hope you could do it works and most importantly, showing me what the error care...

    Feel free to change what you want in the application

    https://Apex.Oracle.com/pls/Apex/f?p=4550:1:2838412118981:

    BANCO_PRUEBAS

    ADMIN

    password

    It is interesting that, when I use APEX 5.0.1.00.06, I have some errors form appearing not using APEX 4.1.0.00.32

    Check your 77569 application-> Page 1. I have modified the page element attributes. Now it's working.

    Here are the changes (I will explain for P1_NOMBRE, did the same for the P1_APELLIDOS and P1_CATEGORIA):

    • 'Source' has become article attributed to him include:

    Source: Replacement always, value that exists in session state

    Source type: column database

    Source of value or an expression: NUMBER

    • The "Default" article now the following attributes:

    By default of Type: PL/SQL function body

    Default value:

    DECLARE
    
      L_NOMBRE B_LISTA_EMPLEADOS.NOMBRE%TYPE;
    
    BEGIN
    
      select NOMBRE
      into   L_NOMBRE
      from   B_LISTA_EMPLEADOS
      where  USERNAME = :APP_USER;
    
      RETURN L_NOMBRE;
    
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
      RETURN NULL;
    
    END;
    

    Kind regards

    Kiran

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

  • The 2 field in the conditional form field validation

    I searched on this forum, but didn't come with anything. I need to package the field validation in a table on the value of another field in the form of tables. How do I refer to a field in the form of table in the Condition section?

    I like to use (in my example SPECIES are the domain I want as my conditional validation on):

    Condition type: PL/SQL
    Expression 1: SPECIES! = "NFSH.

    So I need to know how to run the SPECIES matter in my tabular form in my conditional statement.

    Thank you!
    John

    What version are you on? 4.1 you can create validations of columns as a table and reference columns by using bind variables syntax, such as ": SPECIES.

  • PDF - 2 criteria form field validation?

    Is anyone know how can I get a pdf digital to be validated in a range but also form field to validate that the value is equal to or less than the value of another digital field?

    Thank you!

    I think the following custom validation script will do what you want:

    function range_validate1() {}

    Do nothing if the field is empty

    If (! event.value) {}

    return;

    }

    Initialize variables

    var sError = "";

    nMin var = 0;

    var nMax2 = 26;

    var = nVal + event.value;  User entered, converted to a number value

    Get the field value, converted to a number

    var nMax1 = + getField("Text1").value;

    If the value is less than the minimum

    If (nVal< nmin)="">

    sError = "Please enter a value greater or equal to:"+ nMin;»

    }

    If the value is greater than the value of the field more...

    If (nVal > nMax1) {}

    sError = "Please enter a value less than or equal to:"+ nMax1;»

    }

    If the value exceeds the maximum. possible value

    If (nVal > nMax2) {}

    sError = "Please enter a value less than or equal to:"+ nMax2; "

    }

    The attention of the user and deny the value

    If (sError) {}

    App.Alert (sError, 0);

    Event.RC = false;

    }

    }

    Call the function

    range_validate1();

    The function can be placed in a JavaScript script at the level of the document, but the last line should be the custom for the field validation script. Replace "Text1" in the line that contains the statement getField to the actual name of the other field.

  • Form field validation script?

    Hi all, I'm unable to find Court field validation in an Acrobat document I created. I don't want that get submitted, so I don't want to go that route, but I'm trying to understand how to have 3 fields in my document are validated to ensure they are filled until the form is flattened and saved. I found many examples online, but they are all different, and none seem to work right. I know it is something simple, but I'm just not hitting the right solution. Any help would be greatly appreciated! Thank you.

    What I would do, is to create a function at the level of the document, something like:

    // Document-level function, coded for clarity
    function validateFlattenAndSave() {
    
        // Get the field values
        var f1 = getField("text1");
        var f2 = getField("text2");
        var f3 = getField("text3");
    
        var v1 = f1.valueAsString;
        var v2 = f2.valueAsString;
        var v3 = f3.valueAsString;
    
        // Build up an error message string
        var s = "";
    
        if (!v1) {
            s += "Field: " + f1.name + " is blank.\r";  // \r = carriage return
        }
    
        if (!v2) {
            s += "Field: " + f2.name + " is blank.\r";
        }
    
        if (!v3) {
            s += "Field: " + f3.name + " is blank.\r";
        }
    
        // If any fields are blank, alert user and do not proceed
        if (s) {
            app.alert(s, 1);
            return;
        }
    
        // Code to flatten and save goes here.
    
    }
    

    The code could be made less wordy, but you should get the idea. If there are more fields, I have probably to specify field names in a table and use a loop to search for empty values, adding to the string of alert, according to the needs.

    Call this function in the event that you have your current code as follows:

    validateFlattenAndSave();
    
  • SELECT with the matter in that statement based on the procedure returning a Boolean

    Hi all

    I try to build a select statement with a case where the condition.
    SELECT COL_ID, COL_TITLE, COL_COMMENT,
               ( CASE WHEN COL_IT = :USER_ID THEN 'Y' 
                           WHEN COL_USER = :USER_ID THEN 'Y'
                           WHEN REGEXP_LIKE(COL_IT_ADD, '(^|:)(' || :USER_ID || ')(:|$)') THEN 'Y'
                           ELSE 'N' END ) MY_COL,
    FROM   MY_TABLE
    WHERE  ( CASE WHEN MY_PACKAGE.AUTHORIZE('IT') = TRUE THEN 'Y'
                           WHEN MY_PACKAGE.AUTHORIZE('IT') = FALSE AND COL_USER = :USER_ID THEN 'Y'
                           WHEN MY_PACKAGE.AUTHORIZE('IT') = TRUE AND  REGEXP_LIKE(COL_IT_ADD, '(^|:)(' || :USER_ID || ')(:|$)') THEN 'Y'
                           ELSE   'N' END ) = 'Y'
    The case for the calculation of the value of the column works fine. Run this query without the where also works in condition.
    But in the condition, I get the following error: SQL error: ORA-00920: invalid relational operator 00920. 00000 - "invalid relational operator.
    The MY_PACKAGE procedure. AUTHORIZED (pValue) returns a Boolean value. Is it possible to use a case statement in the WHERE condition to calculate a value and check for this? If not, is there another way to do something like this in a query?

    Thanks for your help
    Chrissy

    The Boolean data type is unknown in SQL... you cannot use functions that return Boolean values in SQL.

    You can add a function overloaded in the package which returns a 'Y' or a 1, or something else that is a data type in SQL.

  • A field validation can point to a different record type fields?

    Validation of field based on another field of registration Type

    I am trying to generate a validation in a custom object that summarizes the fields under the record type account.

    The names of the fields of OBI (the location and the name of the table field):
    "- Take into account the custom settings. S_INT_13 + ""-account of custom settings '. " S_INT_14 + ""-account of custom settings '. " S_INT_11

    My questions: peut a field validation, point to a different record type fields? My thought was that if OBI can look in all of the types of records that all CRM must be able, including field validations.

    Thank you

    David

    Hello!

    I'm afraid that's not possible at the moment. You will have to wait for version 16, I think that having such opportunities.
    The R16 will allow you to create a workflow through different types of records (for example, to create a task on the account related to the service request when a new service request is created). I hope that there will be equal opportunities with the validation rules...

    Hope this will help, do not hesitate to ask for more.

    Max

  • SelectOneChoice required field validation problem

    Got a query on the selectonechoice required field validation

    Below is the code works well, I generate the list of static elements (VO)

    < af:selectOneChoice value = "#{bindings." Division.inputValue}.

    label = "Division" styleClass = "Division".

    required = "true" autoSubmit = 'true '.

    shortDesc = "#{bindings." Division1.hints.ToolTip}.

    ID = "soc1" >

    < af:forEach elements = "#{bindings." Var Division1.Items}"="row">

    "< f: selectItem itemLabel =" #{row.label} "ItemValueOptional =" #{row.label} ".

    ID = "si21x1x25" / >

    < / af:forEach >

    < / af:selectOneChoice >

    The question is how to add "- Select -" in the above code and default value "- Select -" selected must, if the value is "- Select -", he must request the validation

    I want to be the label = "- Select -" to be selected by default

  • Export as .xls. Classic report type: SQL (body of function from PL/SQL returning the SQL) query

    Hey guys,.

    I'm using version 4.2.6 apex. The theme is 26.

    IM also using Listener Oracle APEX.

    I can print my classic report in PDF or CSV format.

    But I need to export it as a .xls extension.

    Report type: SQL (body of function from PL/SQL returning the SQL) query

    I need is like this cause my 'where' clause type is dynamic.

    Look at using this method: Tom's Blog: a non-standard export excel 2010 (.xlsx)

    I do something similar for downloads to excel in my projects...

    Thank you

    Tony Miller
    Software LuvMuffin
    Ruckersville, WILL

  • ORA-06504: PL/SQL: return variables of the game results or the query types do not match

    Hello!

    I have a simple object type and a proecdure in which I am trying to use it to insert into another table

    -object

    CREATE ORREPLACETYPEmt_mtg ASOBJECT

    (

    ACOL NUMBER ,

    BCOL NVARCHAR2 (100)

    );

    CREATE ORREPLACETYPEREF_MTG ASTABLEOFMt_MTG ;

    -same structure as the use of sampletbl target table in the cursor query

    create table tbl_MT_MTG

    (

    ACOL NUMBER ,

    BCOL NVARCHAR2 (100)

    );

    -procedure

    CREATE ORREPLACEINTERIORTEST_PROCEDURE1

    AS

    ref_cur sys_refcursor ;

    REFR ref_mtg ;

    BEGIN

    OPEN ref_cur FOR

    Select acol,

    BCOL

    DE sampletbl rownum<10;

    Fetch ref_cur in bulk collectintorefr;

    Insert intotbl_MT_MTG(acol,bcol)selectacol,bcol fromtable(refr);

    commit;

    CLOSE Ref_cur;

    END;

    /

    When I run this procedure fails with

    ORA-06504: PL/SQL: return variables of the game results or the query types do not match

    ORA-06512: at "TEST_PROCEDURE1", line 10

    ORA-06512: at line 2

    Any help on this please...

    Thanks to an OLD POST below

    so perfect helped me! Thank you

    Tubby

    After 5 years of more :-)

    How to store refcursor in collection How to store refcursor in collection

Maybe you are looking for