Boolean function issue

SQL> create or replace function my_func
2 return boolean as
3 x boolean;
4 begin
5 x := true;
6 return x;
7 end;
8 /
Function created.
SQL> select my_func from dual;
select my_func from dual
ERROR at line 1:
ORA-06552: PL/SQL: Statement ignored
ORA-06553: PLS-382: expression is of wrong type
SQL>
Above is what I thought was a simple function that returns a boolean value. I am doing a asp.net project and i need a simple function to call as a test. I have written a simple function that returns an int, string already and i dont understand the error above....
Can some one give me an example of a function that returns a boolean value based around a simple table like the emp table for example. That would be great thanks ( or else tell me whats wrong with my simple ha ! function above)

I'd rather put some sort of wrapper on the oracle side. The reason for this is that the application i'm building is designed to allow users run functions or procedures and pass as many arguments as they want to the c# class. This is what I've been working on but there are data type issues arising.
create or replace function convFunc
--funcName varchar2
return number
as
a boolean;
b number;
begin
--a := myFunction();
a:=funcName
--Is there any way I can pass in the name of the function to be called
and concatenate the () brackets to it and assign it to a. I tried
funcName:= funcName||(); but it wont let me do that. The second problem is that as the function returns true or false but the function name comes in as a string there is a type mis match... There has to be some way of solving the problem on the oracle side. Again all I want from the user is the function name and parameters
Sorry if i'm annoying people with similar posts
if a=true then
b:=1;
return 1;
else
b:=0;
return 0;
end if;
end;

Similar Messages

  • How to write Boolean function (If Then Else)?

    Hi all,
    I have a logic to write in the query. It is:
    If (A = 0 and B = 0)
    Then 0
    Else
            If (A = 0 and B > 0)
            Then 100
            Else
                   A/B  (we want to show %)
    How to use boolean function to write this Netted If Else statement? Thank you in advance!

    Hi
    If (A = 0 and B = 0)
    Then 0
    Else
    If (A = 0 and B > 0)
    Then 100
    Else
    A/B (we want to show %)
    1. create a formula in the query designer. and use this formula for if - else
    ( ( (A==0) AND (B==0) ) * 0) +  ( ( a==0 ) AND (B >0 ) * 100 + (A/B*100) )
    : denotes THEN
    + : denotes ELSE
    See if this works.
    Assign points if helpfull
    From
    ManesH

  • HOW TO MAKE A BOOLEAN FUNCTION IN LABVIEW5.0

    I want to use a boolean funtion but it does not exist in existing functions?so how can I do it?I final aim is how to make a VALVE boolean function and how to use it?please teach me,experts! Thank you very much!

    Hi,
    what do you mean by "boolean function"?
    For boolean operations you can use
    1. Case structure. It is located in Functions->Structures
    2. Boolean functions (such as AND, OR, NOT, etc.). They are located in Functions->Boolean
    3. Comparison functions (such as equal?, greater?, less?, etc.). They are located in Functions->Comparison
    You have to give more info about your problem.
    Good luck.
    Oleg Chutko.

  • To use Boolean function in DECODE or CASE statement

    Hi all
    I have a scenario where i need to use a boolean function inside DECODE statement. When i tried this way iam getting "ORA-06553: PLS-382: expression is of wrong type".
    I doubt whether i can use boolean function inside DECODE or not?
    My query will be like this:
    select decode(my_fuction( ),'TRUE',1,'FALSE',0) from dual;
    Any help is highly appreciated.
    Thanks
    Sriram

    Overloaded functions must differ by more than their
    return type . At the time that the overloaded
    function is called, the compiler doesn't know what type
    of data that function will return. The compiler cannot,
    therefore, determine which version of the function to
    use if all the parameters are the same.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Can you use boolean function in where clause

    Hi,
    I have a boolean function. Is it possible to use it in where clause of query.
    Eg;
    is_prime(13) returns boolean
    select 1 from dual where is_prime(13)

    What about something like this
    Create or replace function boolret(id number) return boolean as
    begin
    If id <10 then
    return true;
    elsif id>10 and id<100 then
    return false;
    else
    return null;
    end if;
    end;
    1 declare
    2 id_cat boolean;
    3 begin
    4 id_cat:= boolret(8);
    5 dbms_output.put_line(id_cat);
    6* end;
    SQL> /
    dbms_output.put_line(id_cat);
    ERROR at line 5:
    ORA-06550: line 5, column 2:
    PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
    ORA-06550: line 5, column 2:
    PL/SQL: Statement ignored
    It seems PL/Sql doesn't have any datatype like Boolean,But it handles Boolean like datatype.
    Regards
    Raj deep.A

  • Function issue of Cross-Reference

    Hi,
    thanks for your attention on this topic.
    there is function issue of Cross-Reference.
    when click the Cross-Reference after re-installed the software (adobe Framemaker 7.10), the function is not working. please kindly check the screenshots below:
    Error message below:
    Please help to check this issue.
    software: Adobe Framemaker 7.10
    System: windows xp sp3
    thanks in advance for your support .
    Message was edited by: Lu Steven

    Fire the error log off to the e-mail address indicated in the error message and then contact Adobe Support.

  • How to Use a boolean function in a process

    Hi,
    I created a boolean function named change_pwd with 3 varchar2 parameters : login_name, old-pwd and new_pwd. I would like to use it in a process but I can't, this is how I do it :<br><br>
    select change_pwd (
    v('P12_Login'),v('P12_Old_Pwd'),v('P12_New_Pwd')) from dual;
    <br><br>
    Benn

    I got this error : <br><br>
    ORA-06550: line 2, column 8: PLS-00382: expression is of wrong type ORA-06550: line 2, column 1: PLS-00428: an INTO clause is expected in this SELECT statement
    <br><br>
    and here is my function :<br><br>
    create or replace function "CHANGE_PWD"<br>
    (p_username in VARCHAR2,<br>
    p_old_password in VARCHAR2, <br>
    p_new_password in VARCHAR2)<br>
    return boolean<br>
    is<br>
    l_count number;<br>
    l_password varchar2(4000);<br>
    l_stored_password varchar2(4000); <br>
    l_idcontact number;<br>
    begin<br>
    -- Check to see if the user is in the user table<br>
    select count(*) into l_count from CONTACTS where MATRICULE = p_username;<br>
    if l_count > 0 then<br>
    -- take the stored password<br>
    select u.MOTDEPASSE, u.IdContacts into l_stored_password, l_idcontact from <br>UTILISATEURS u, CONTACTS c where u.IdContacts = c.IdContacts AND c.MATRICULE = p_username;<br>
    <br>
    -- apply the cash function<br>
    l_password := user_hash(p_username, p_old_password);<br>
    <br>
    -- compare the hashed password with the stored password<br>
    if l_password = l_stored_password then<br>
    -- change password<br>
    update UTILISATEURS set MotDePasse = user_hash(p_username, <br>p_new_password) where idcontacts = l_idcontact;
    return true;<br>
    else<br>
    return false;<br>
    end if;<br>
    else<br>
    return false;<br>
    end if;<br>
    end;<br>

  • Best design for Boolean function from simple query

    Hello,
    what is the most efficient, shorter, readable, simple way to make a boolean function that simply return true or false from a simple query that return 0 or 1 to n records?
    Is this solution using a cursor's the best (working...):
       FUNCTION is_date_present (p_date IN DATE)
          RETURN BOOLEAN
       IS
          CURSOR chk_cursor
          IS
             SELECT COUNT (*)
               FROM target_dates
              WHERE target_date = p_date;
          nb   NUMBER := 0;
       BEGIN
          OPEN chk_cursor;
          FETCH chk_cursor
           INTO nb;
          CLOSE chk_cursor;
          IF nb >= 1
          THEN
             RETURN TRUE;
          ELSE
             RETURN FALSE;
          END IF;
       END;Performance, clarity and simplicity are important...
    Thanks

    Well, I prefer (not tested):
    FUNCTION is_date_present (p_date IN DATE)
    RETURN BOOLEAN
    IS
    nb NUMBER := 0;
    BEGIN
    SELECT COUNT (*)
    INTO nb
    FROM target_dates
    WHERE target_date = p_date;
    IF nb >= 1 THEN
    RETURN TRUE;
    LSE
    RETURN FALSE;
    IF;
    END;Regards,
    MiguelWhy count multiple records when you only care if you get at least 1 occurrence? Just wasted cycles.
    FUNCTION is_date_present (p_date IN DATE)
    RETURN BOOLEAN
    IS
    nb NUMBER := 0;
    BEGIN
      SELECT COUNT (*)
      INTO nb
      FROM DUAL
      WHERE EXISTS
          SELECT NULL 
          FROM target_dates
          WHERE target_date = p_date
      IF nb >= 1 THEN
         RETURN TRUE;
      ELSE
         RETURN FALSE;
      END IF;
    END;Or you could just add a ROWNUM = 1 on to yours, either way.

  • Boolean function

    Hi
    I am using standard Boolean function ' if '. I want to set the confition in that. How can I do that ?? Either right click or double click is not leading to any screen where I can put my condition. If length comes to 15 I want to route to one channel and when it comes to 20, I want to route to channel two. How to set this condition in "if" node function ?? Basically I want navigation to use this funcation.
    Thanks
    kumar

    Add the field you wish to check
    add the length (text) function.
    Add the equalS function and build this up....
    Look at Page 23 here for an example...  https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/be05e290-0201-0010-e997-b6e55f9548dd

  • Boolean Function Ifs not giving proper out put

    Hi ,
           I am using boolean function Ifs in message mapping of one of my scenerio.
    My problem is First argument have  exist function and if first argument is true it gives value of second argument but if is false , I am passing a Constant value in else condition(3rd argument) it give no out put.Can you suggest how can i resolve it.

    Hi Mohit,
    In your case you need not to use IFs , instead make use of boolean function If , it will work fine for you.
    Regards
    Nishant Kumar Singh

  • Boolean() function gives true in all cases

    The implementation of the boolean() function in BPEL (version 10.1.2.1.0) have an FATAL ERROR.
    boolean(0) gives 1 and
    boolean(false) gives 1
    I have tried to make a TAR, however I cannot connect to meta-link today.
    Regards,
    Flemming

    Thanks for your answer Clemens.
    Perhaps, I missed to send you my test-case.
    Try with the following assign, based on the schema below with input and output defined as boolean (in default generated bpel-syncron project):
    <assign name="Assign_1">
    <copy>
    <from expression="boolean(bpws:getVariableData('inputVariable','payload','/client:TestIfProcessRequest/client:input'))"/>
    <to variable="outputVariable" part="payload" query="/client:TestIfProcessResponse/client:result"/>
    </copy>
    </assign>
    <types>
    <schema attributeFormDefault="qualified"
    elementFormDefault="qualified"
    targetNamespace="http://xmlns.oracle.com/TestIf"
    xmlns="http://www.w3.org/2001/XMLSchema">
    <element name="TestIfProcessRequest">
    <complexType>
    <sequence>
    <element name="input" type="boolean"/>
    </sequence>
    </complexType>
    </element>
    <element name="TestIfProcessResponse">
    <complexType>
    <sequence>
    <element name="result" type="boolean"/>
    </sequence>
    </complexType>
    </element>
    </schema>
    </types>
    It gives the result
    <TestIfProcessResponse>
    <result>true</result>
    </TestIfProcessResponse>
    no mather what I gives as input in the BPEL Console.
    I have tried with 0, 1, true, false.
    Regards,
    Flemming

  • Invoking a Database boolean Function from Java

    Hi,
    I have the following boolean database function --
      FUNCTION isPositive(p_count NUMBER) RETURN BOOLEAN
      IS
      BEGIN
        IF p_count < 0 THEN
          return false;
        END IF;
        return true;
      END;I read somewhere that CallableStatement doesn't support the boolean function.
    I tried to use CallableStatement to invoke the above function as follows --
        String sql = "begin ? := helperpkg.isPositive(?); end;";
        CallableStatement cs = jdbcConn.prepareCall(sql);
        cs.registerOutParameter(1, java.sql.Types.BOOLEAN);
        cs.setInt(2, -5);
        cs.execute();
        return cs.getBoolean(1);But it gave me the exception --
    java.sql.SQLException: Invalid column type
            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
            at oracle.jdbc.driver.OracleStatement.get_internal_type(OracleStatement.java:6164)
            at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterBytes(OracleCallableStatement.java:244)
            at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:393)
            at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:462)
            at DBConnector.invokeFunction(DBConnector.java:63)
            at DBConnector.main(DBConnector.java:21)Please advice.
    Thanks

    I read somewhere that CallableStatement doesn't
    support the boolean function.http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/apxref.htm#BABFECBJ
    Best regards
    Maxim

  • Creating multiple input terminals for a boolean function?

    Hi,
    I was wondering how to create multiple input terminals for a boolean function? I'm pretty sure i've done so before, but I can't seem to remember  how, I need to for a school assignment, and i've searched in the help in the program for about 3 hours before switching to google, which also didn't give me an answer.
    I'm beginning to feel quite stupid especially since it is something quite simple I'm sure, but I just don't know how 
    my teacher is currently on vacation and since it was an assignment I actually should've done in september I doubt any of the other students still recalls.
    What I want to do is create an or-function, with 3 boolean inputs, does anyone know how to do that?
    Thanks

    Look again at the picture posted above, it shows exactly what you need, the "compound arithmetic" node, found on the numeric and the boolean palette.
    Resize it to the desired numbers of inputs.
    right-click for the desired operation (AND, OR, XOR, etc.)
    right-click on each terminal to invert the particular input or output (shows as small circle).
    (I am not sure who gave the one star rating above, but that was certainly undeserved )
    Message Edited by altenbach on 08-11-2007 08:46 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    compoundAND.png ‏1 KB

  • Give me detail functions  use boolean function,  use  detail

    give me detail functions  use boolean function,  use  detail func in calculated key figure

    Hi,
    Adding to that some more few links which helps you are
    Defining Formulas:[http://help.sap.com/saphelp_nw70/helpdata/EN/71/0aec3b6e011341e10000000a114084/content.htm]
    Percentage Functions:[http://help.sap.com/saphelp_nw70/helpdata/EN/e2/16f13a2f160f28e10000000a114084/content.htm]
    Data Functions:[http://help.sap.com/saphelp_nw70/helpdata/EN/e2/16f13a2f160f28e10000000a114084/content.htm]
    Boolean Operators:[http://help.sap.com/saphelp_nw70/helpdata/EN/23/17f13a2f160f28e10000000a114084/content.htm]
    Technicle Notes About Formula Operators:[http://help.sap.com/saphelp_nw70/helpdata/EN/37/b4393ccab19b57e10000000a114084/content.htm]
    Defining Restricted Key Figures :[http://help.sap.com/saphelp_nw70/helpdata/EN/61/d0b143aa26b849b4e79a859ea1d7d1/content.htm]
    Defining Calculated Key Figures :[http://help.sap.com/saphelp_nw70/helpdata/EN/13/e072abaddb574284d22361f0b824bf/content.htm]
    [http://help.sap.com/saphelp_nw70/helpdata/EN/d3/8057f830a911d4b2be0050dadfb23f/content.htm]
    [http://help.sap.com/saphelp_nw70/helpdata/EN/d7/c70540ba5ee569e10000000a155106/content.htm]
    Regards,
    Rajkandula

  • Test Boolean Function

    Dear All
    How I Can test boolean function that return true or false.

    Hi,
    Write a Wrapper Function , that is, another function that is wrapped around your first fucntion, which you can call from SQL, and call it.
    CREATE OR REPLACE FUNCTION check_mobile_varchar2 (p_mobile IN VARCHAR2)
    RETURN  VARCHAR2
    IS
        return_string   VARCHAR2 (5) := 'FALSE';
    BEGIN
        IF  check_mobile (p_mobile)
        THEN
            return_string := 'TRUE';
        END IF;
        RETURN  return_string;
    END  check_mobile_varchar2
    /To test:
    SELECT  txt
    ,       CHECK_MOBILE_VARCHAR2 (txt)    AS check_mobile
    FROM    table_x
    ;This assumes you really want a function that returns a BOOLEAN, and therefore can't be used in SQL. A lot of folks just write functions that return 'TRUE' or 'FALSE' (or 'T' or 'F', 1 or 0) in the first place.
    If check_mobile is in a package, check_mobile_varchar2 should be in the same package.
    Edited by: Frank Kulash on Mar 13, 2011 11:46 AM
    Added RETURN startement.

Maybe you are looking for

  • WINDOWS ON A MAC OS X HELP!

    I have windows vista installed on my macbook and can switch back and forth from using the mac operating system and that of the vista operating system. WHAT I WANT TO KNOW: Is it possible to use windows programs such as microsoft word and powerpoint w

  • Hp dv6845 balnk screen problem

    My hp DV6845 special edition is showing up a blank screen on turning on the system. The laptop seems to be working but it show a blank screen on turning on. This error occurred when I was watching a video on it and suddenly it hanged and upon restart

  • Mac App Store not working - first day with new MacBook Pro

    Hi guys, I received a new MacBook Pro 13 inch with retina display today and have been working on it this evening but I have a problem: My app store won't open. It was fine earlier - I downloaded both textwrangler and notepad - but now, whenever I cli

  • How long is a replacement ipod covered

    My 4th Gen 40 GB ipod's HD died last Sept. I had apple care and it was replaced. The replacement drive died a month ago. I went to the apple site and was told it was out of warranty. I sent the ipod to a 3rd party co. and they said it again was the h

  • JCO Destination problem

    Hi All,    I have integrated my webdynpro application in my portal , the application was working for quite some time all of a sudden it is giving the following error Could not create JCOClientConnection for logical System: WD_SAP_MODELDATA_DESTINATIO