Boolean value in function

Dear All,
I have the function like as follows
Function Test_Bool (id number,name varchar2 ) return boolean as
begin
return true;
end;
for the above function i need to use as follows
select 'X' from dual where Test_Boo(1,'dddd') = 1 ;
but its show the error like invalid identifier
How to do this? just i want to check in where condition like as true
Thanks ...

Hi,
842086 wrote:
Dear All,
I have the function like as follows
Function Test_Bool (id number,name varchar2 ) return boolean as
begin
return true;
end;
for the above function i need to use as follows
select 'X' from dual where Test_Boo(1,'dddd') = 1 ;
but its show the error like invalid identifier
How to do this? just i want to check in where condition like as true
Thanks ...
If you want to say:
where Test_Boo(1,'dddd') = 1
then you want Test_Boo to return a NUMBER, not a BOOLEAN.
If you can't change Test_Boo so that it returns a NUMBER, you can write a wrapper function that does:
CREATE OR REPLACE FUNCTION  test_boo_num
(   in_id    IN  NUMBER
,   in_name  IN  VARCHAR2
RETURN NUMBER
IS
    return_val  NUMBER;
    test_boo_true BOOLEAN  := test_boo (in_id, in_name);
BEGIN
    IF  test_boo_true
    THEN
        return_val := 1;
    ELSIF NOT test_boo_true
    THEN
        return_val := 0;
    END IF;
    RETURN  return_val;
END  test_boo_num;
SHOW ERRORS
You can call the wrapper function from SQL statements like this:
where   Test_Boo_num (1, 'dddd')  = 1
I assume test_boo is actually more complicated than what you posted.  If test_boo never returns UNKNOWN, then the wrapper function can be simplified a little.

Similar Messages

  • Cell with boolean value not rendering properly in Swing (custom renderer)

    Hello All,
    I have a problem rendenring boolean values when using a custom cell renderer inside a JTable; I managed to reproduce the issue with a dummy application. The application code follows:
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.lang.reflect.InvocationTargetException;
    import java.util.ArrayList;
    import java.util.Date;
    import java.util.List;
    import java.util.logging.Logger;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.SwingUtilities;
    * Simple GUI that uses custom cell rendering
    * @author josevnz
    public final class SimpleGui extends JFrame {
         private static final long serialVersionUID = 1L;
         private Logger log = Logger.getLogger(SimpleGui.class.getName());
         private JTable simpleTable;
         public SimpleGui() {
              super("Simple GUI");
              setPreferredSize(new Dimension(500, 500));
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setLayout(new BorderLayout());
         public void constructGui() {
              simpleTable = new JTable(new SimpleTableModel());
              simpleTable.getColumnModel().getColumn(2).setCellRenderer(new HasItCellRenderer());
              SpecialCellRenderer specRen = new SpecialCellRenderer(log);
              simpleTable.setDefaultRenderer(Double.class, specRen);
              simpleTable.setDefaultRenderer(String.class, specRen);
              simpleTable.setDefaultRenderer(Date.class, specRen);
              //simpleTable.setDefaultRenderer(Boolean.class, specRen);
              add(new JScrollPane(simpleTable), BorderLayout.CENTER);          
              pack();
              setVisible(true);
         private void populate() {
              List <List<Object>>people = new ArrayList<List<Object>>();
              List <Object>people1 = new ArrayList<Object>();
              people1.add(0, "Jose");
              people1.add(1, 500.333333567);
              people1.add(2, Boolean.TRUE);
              people1.add(3, new Date());
              people.add(people1);
              List <Object>people2 = new ArrayList<Object>();
              people2.add(0, "Yes, you!");
              people2.add(1, 100.522222);
              people2.add(2, Boolean.FALSE);
              people2.add(3, new Date());
              people.add(people2);
              List <Object>people3 = new ArrayList<Object>();
              people3.add(0, "Who, me?");
              people3.add(1, 0.00001);
              people3.add(2, Boolean.TRUE);
              people3.add(3, new Date());
              people.add(people3);
              List <Object>people4 = new ArrayList<Object>();
              people4.add(0, "Peter Parker");
              people4.add(1, 11.567444444);
              people4.add(2, Boolean.FALSE);
              people4.add(3, new Date());
              people.add(people4);
              ((SimpleTableModel) simpleTable.getModel()).addAll(people);
          * @param args
          * @throws InvocationTargetException
          * @throws InterruptedException
         public static void main(String[] args) throws InterruptedException, InvocationTargetException {
              final SimpleGui instance = new SimpleGui();
              SwingUtilities.invokeAndWait(new Runnable() {
                   @Override
                   public void run() {
                        instance.constructGui();
              instance.populate();
    }I decided to write a more specific renderer just for that column:
    import java.awt.Color;
    import java.awt.Component;
    import javax.swing.JTable;
    import javax.swing.UIManager;
    import javax.swing.table.DefaultTableCellRenderer;
    * Cell renderer used only by the DividendElement table
    * @author josevnz
    final class HasItCellRenderer extends DefaultTableCellRenderer {
         protected static final long serialVersionUID = 2596173912618784286L;
         private Color hasIt = new Color(255, 225, 0);
         public HasItCellRenderer() {
              super();
              setOpaque(true);
         @Override
         public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
              Component comp = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
              int desCol = table.convertColumnIndexToView(1);
              if (! isSelected && value instanceof Boolean && column == desCol) {
                   if (((Boolean) value).booleanValue()) {
                        comp.setForeground(hasIt);     
                   } else {
                        comp.setForeground(UIManager.getColor("table.foreground"));
              return comp;
          * Override for performance reasons
         @Override
         public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {
              // EMPTY
         @Override
         protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
              // EMPTY
         @Override
         public void revalidate() {
              // EMPTY
         @Override
         public void validate() {
              // EMPTY
    } // end classBut the rendering comes all wrong (a String saying true or false, not the expected checkbox from the default renderer) and also there is a weird flickring effect as this particular boolean column is editable (per table model, not show here)...
    I can post the table model and the other renderer if needed (didn't want to put too much code on the question, at least initiallty).
    Should I render a checkbox myself for this cell in the custom renderer? I'm puzzled as I expected the default renderer part of the code to do this for me instead.
    Thanks!
    Edited by: josevnz on Apr 14, 2009 12:35 PM
    Edited by: josevnz on Apr 14, 2009 12:37 PM

    camickr
    Thats because the default render is a JLabel and it just displays the text from the toString() method of the Object in the table model.What I meant to say is that I expected the JCheckbox not a String representation of the boolean value.
    Thats because a different renderer is used depending on the Class of data in the column. Look at the source code for the JTable class to see what the "default >renderer for the Boolean class" is. Then you can extend that or if its a private class then you will need to copy all the code and customize it.At the end I looked at the code and replicated the functionality I needed. I thought than maybe there was a way to avoid replicating the same logic all over again in order to implement this functionality. Good advice, though.
    see you learned nothing from your last posting. This is NOT a SSCCE. 90% of the code you posted is completely irrelevant for the described problem. There is abosutelly no need to post the custom TableModel, because there is no need to use a custom TableModel for this problem. The TableModel has nothing to do with how a column is rendererd.The custom table model returns the type of the column (giving a hint to the renderer on what to expect, right?) and for the one that had a problem it says than the class is Boolean. That's why I mentioned it:
    public Class getColumnClass(int columnIndex) {
        // Code omited....
    You also posted data for 4 columns worth of data. Again, irrelevant. Your question is about a single column containing Boolean data, so forget about the other columns.
    When creating a SSCCE you don't start with your existing code and "remove" code. You start with a brand new class and only add in what is important. That way hopefully if you made a mistake the first time you don't repeat it the second time.That's what I did, is not the real application. I copy & pasted code in a haste from this dummy program on this forum, not the best approach as it gave the wrong impression.
    Learn how to write a proper SSCCE if you want help in the future. Point taken, but there is NO need for you to be rude. Your help is appreciated.
    Regards,
    Jose.

  • 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

  • Changing a boolean value based on two buttons

    I know that this is a ridiculously simple question, but I've been having trouble with it.
    How would you set a boolean value based on the input from two other boolean values? Essentially what I want, in pseudocode, is this:
    boolA = true
    if (boolB)
         boolA = false
    if (boolC)
         boolA = true
    It should be really simple to do, but I can't figure it out. The problem is getting it to stay false, for example, after boolB goes back to false, and not just to have it only momentarily go to false. I want it to stay false until boolC goes to true, regardless of what boolB does after that. Any advice?
    Thanks,
    Logan Williams

    I would say implies is close to what was asked for.  However, the only issue is that for the case where both B and C are false, the logic shows that there is no change to A.  It is initially True, but if it happens to be False because of further changes, there is nothing in the If statements to change the logic.  And that is what is asked for.  That the Result stays False even when B goes back to False.  But the Implies function says that  F and F must be True.
    As described
    B         C         Result A
    T          T          T (because C is evaluated 2nd)
    T          F          F
    F          T          T
    F          F          x (initially T, but the code shown and what is asked for is actually no change from previous state)
       Implies Truth Table
    B         C         Result A
    T          T          T
    T          F          F
    F          T          T
    F          F          T

  • Java & Acces: pass boolean values

    Ok I'm totally new at this so the following text will hopefully be understandable. I hope you guys can give me a hand over here.
    The case:
    I'm making a java function that has to create a new user of my database. This user is supposed to get a name, a password and can have 4 functions (Administrator, Author, Reader, Coreader).
    To identify the 4 functions i used a checkbox in my database. So when the box is checked the person is a Admin/author/... Now I was wondering how i can use Java (using a query) to set these values checked or non-checked.
    I thought I'd use booleans, however, my compiler says there is a General Error (all the names of the columns are right, so that's not the deal, my database is working properly and such, ...)
    So here's my code:
    (note that i used these marks ' ' here for the booleans, i tried all kinds of things such as dropping them, using them, ... it doesn't seem the problem...)
    public void addNewUser(String username, String password, boolean admin, boolean author, boolean reader, boolean coreader)
    String query1 = "UPDATE user SET username = '" + username + "' AND password = '"
    + password + "' AND administrator = '" + admin + "' AND author ='" + author
    + "' AND reader ='" + reader + "' AND coreader ='" + coreader + "'";
    try
    stmt = global.createStatement();
    stmt.executeUpdate(query1);
    global.showMessage("The new user, " + username + ", has been added successfuly", "Succesfuly added");
    catch(Exception e)
    global.showError("An error has occured while connecting to the database" + e.toString(), "SQL Error");
    finally
    global.closeConnection();
    Hope you guys can help. Thanks a lot!

    It's possible to do this; it's just that your SQL syntax is completely wrong. An SQL UPDATE statement looks as follows:
    UPDATE table SET column1 = value1, column2 = value2, column3 = value3 WHERE expression
    You're using 'AND' instead of commas, which is the first thing that goes wrong. The second thing that goes wrong is that you're building the SQL statement from bits of string and values. This is a habit that many novice programmers use, and open the door wide for SQL injection attacks. I you do this sort of thing on a web site, you could end up with your customers' credit card details being exposed.
    But because you're just passing the boolean values into the string, they get expanded to a string value, hence TRUE or FALSE. However, because they are string literals, they should be surrounded by single quotes.
    This brings us to the third problem: you're using an UPDATE statement to insert a new record. Use an INSERT statement instead.
    It would be better to use a PreparedStatement. In this case, your code would look as follows:
    PreparedStatement stmt =
        global.prepareStatement( "INSERT INTO user " +
                "( username, password, administrator, author, reader, coreader ) " +
                "VALUES ( ?, ?, ?, ?, ?, ? )" );
        stmt.setString( 1, username );
        stmt.setString( 2, password );
        stmt.setBoolean( 3, admin );
        stmt.setBoolean( 4, author );
        stmt.setBoolean( 5, reader );
        stmt.setBoolean( 6, coreader );I have no idea whether this will work: I don't know Access, and booleans are not a standard feature of SQL. I also don't know whether Microsoft have created their own flavour of SQL, as they are wont to do with any standard.
    All in all, though, you have to really work on your SQL. Three major mistakes in such a simple piece of code means that you don't understand SQL syntax. You may copy and paste this for your assignment, but unless you understand what you're actually doing, you're going to run into trouble again very soon.
    - Peter

  • Best way to check boolean value

    Hi!
    I have a schema defining an XML element with a boolean attribute. The document related to this schema use true/false literal boolean values, eg:
    <myelement myattribute="false"/>....<myelement myattribute="true"/>
    The data is stored in binary xml storage.
    I query the db on the boolean attribute with an xpath condition like this:
    ..../myelement[@myattribute=false()]
    Querying the db with this method:
    SELECT XMLQuery('....' returning content) from dual
    all works as expected.
    Instead, using:
    SELECT XMLQuery('....' ' PASSING OBJECT_VALUE RETURNING CONTENT)
    FROM "myxmltable"
    WHERE XMLExists('....' PASSING OBJECT_VALUE);
    I get the error: ORA-31038: Invalid hexBinary value: "false"
    To get the second query method working, I have to change the xpath condition, forcing a string comparison:
    ..../myelement[string(@myattribute)="false"]
    Can someone explain me this behaviour? What is the best way to check a boolean value? I'd like to write the same xquery working in both methods!
    Thank you.
    Bye
    Mirko

    Hi Geoff
    here the schema:
    <xs:schema xmlns:tns="http://OracleTest" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" targetNamespace="http://OracleTest" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="MyComplexType">
    <xs:sequence>
    <xs:element minOccurs="0" name="FirstChild">
    <xs:complexType>
    <xs:attribute name="A" type="xs:string" />
    <xs:attribute name="B" type="xs:string" />
    </xs:complexType>
    </xs:element>
    <xs:element minOccurs="0" name="SecondChild">
    <xs:complexType>
    <xs:attribute name="S" type="xs:string" />
    <xs:attribute name="B" type="xs:boolean" />
    <xs:attribute name="I" type="xs:integer" />
    </xs:complexType>
    </xs:element>
    <xs:element minOccurs="0" name="ThirdChild">
    <xs:complexType>
    <xs:sequence>
    <xs:element minOccurs="0" name="ThirdChildA">
    <xs:complexType>
    <xs:attribute name="A" type="xs:string" />
    <xs:attribute name="B" type="xs:string" />
    </xs:complexType>
    </xs:element>
    <xs:element minOccurs="0" name="ThirdChildB">
    <xs:complexType>
    <xs:attribute name="C" type="xs:string" />
    <xs:attribute name="D" type="xs:string" />
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    <xs:attribute name="ID" type="xs:string" />
    </xs:complexType>
    <xs:element xdb:defaultTable="MyElement" name="MyElement" type="tns:MyComplexType" />
    </xs:schema>
    and here two sample XML documents:
    <tns:MyElement ID="ID1" xmlns:tns="http://OracleTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://OracleTest http://OracleTest.xsd">
    <tns:FirstChild A="a" B="b" />
    <tns:SecondChild S="s" B="true" I="1" />
    <tns:ThirdChild>
    <tns:ThirdChildA A="aa" B="bb" />
    <tns:ThirdChildB C="cc" D="dd" />
    </tns:ThirdChild>
    </tns:MyElement>
    <tns:MyElement ID="ID2" xmlns:tns="http://OracleTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://OracleTest http://OracleTest.xsd">
    <tns:FirstChild A="aa" B="bb" />
    <tns:SecondChild S="ss" B="false" I="2" />
    <tns:ThirdChild>
    <tns:ThirdChildA A="aaaa" B="bbbb" />
    <tns:ThirdChildB C="cccc" D="dddd" />
    </tns:ThirdChild>
    </tns:MyElement>
    I registered the schema using Enterprise Manager. The "Show SQL" function returned this script:
    BEGIN
    DBMS_XMLSCHEMA.REGISTERSCHEMA(
    schemaurl => 'http://OracleTest.xsd',
    schemadoc => sys.UriFactory.getUri('/Testing/test.xsd'),
    local => FALSE,
    gentypes => FALSE,
    genbean => FALSE,
    gentables => TRUE,
    force => FALSE,
    owner => 'EMILIAROMAGNABUY',
    OPTIONS => DBMS_XMLSCHEMA.REGISTER_BINARYXML);
    END;
    This is my test script:
    -- This works fine: returns only the requested row.
    SELECT XMLQuery('declare default element namespace "http://OracleTest"; collection("/Testing")/MyElement/SecondChild[@B=true()]' returning content) from dual;
    -- This raises the error = SQL Error: ORA-31038: Invalid hexBinary value: "true"
    select xmlquery('declare default element namespace "http://OracleTest"; /MyElement/SecondChild[@B=true()]' passing object_value returning content).getclobval() from "MyElement";
    -- This doesn't work correctly: returns the requested row and two empty rows ?!? I don't like this cast, anyway.
    select xmlquery('declare default element namespace "http://OracleTest"; /MyElement/SecondChild[string(@B)="true"]' passing object_value returning content).getclobval() from "MyElement";
    Thank you
    Mirko

  • How to use Boolean values from 2 different sources to stop a while loop?

    I am working on a program for homework that states E5.4) Using a single Whil eLoop, construct a VI that executes a loop N times or until the user presses a stop button. Be sure to include the Time Delay Exress Vi so the user has time to press the stop botton. 
    I am doing this right now but it seems as though I can only connect one thing to the stop sign on th while loop. It won't let me connect a comparision of N and the iterations as well as the stop button to the stop sign on the while loop. So how would I be able to structure it so that it stops if it receives a true Boolean value from either of the 2 sources (whichever comes first)? 
    Basically, I cannot wire the output of the comparison of N and iterations as well as the stop button to the stop button on the whlie loop to end it. Is there a solution?
    Thanks!
    Solved!
    Go to Solution.

    Rajster16 wrote:
    Using a single Whil eLoop, construct a VI that executes a loop N times or until the user presses a stop button. 
    Look in the boolean palette for something similar to the word hightlighted in red above.
    LabVIEW Champion . Do more with less code and in less time .

  • Error - '' is not a valid boolean value

    I have been receiving the error message = '' is not a valid Boolean value quite frequently.  It doesn’t matter which hierarchy I am in but it’s typically when I do an Add or Insert.  When selecting ‘ok’ on the error message, I’m able to continue on with my work but was just curious what causes this error.  Sometimes when this error shows up and I click ‘ok’, it will take me out of the DRM screen and into whatever else I may have open at the moment.  Any thoughts or ideas?  We are on version 11.1.1.2.103

    As Murali stated-
    It could be a property incorrectly configured, check all the boolean type properties and see if any of them are getting a string value by any chance.
    Thanks
    Denzz

  • Boolean value mapping in udb

    UDB does not support bit data types to my knowledge... what is a recommended way to map a boolean value to a udb database?

    Hi,
    In my opinon INTEGER (or SMALLINT) with 0 (false) and 1 (true) would be ok.
    And then use "Map the Attribute as Object Type".
    Regards,
    Simon

  • What is use of Acquisiton value in functional location in PM module?

    Hello,
    what is use of Acquisiton value in functional location in PM module?
    Regards,
    Ram Rathode.

    HI Ram,
    You can  do an F4 to get the description of a field.
    Please go through following for your reference:
    Acquisition Value of an Asset
    Assets table for Acquisition value and Equipment number
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/01/d544ef4ab311d189740000e8322d00/frameset.htm
    http://help.sap.com/erp2005_ehp_05/helpdata/EN/c1/376976449a11d188fe0000e8322f96/frameset.htm
    Please award if useful.
    Thanks,
    Ravi

  • F:selectItems with default boolean value

    Hi!
    I have problem with using tag f:selectItems. I wrote converter in order to connect my items from the ManyChecbox list directly with my objects instead of strings. Now i would like to connect boolean values with my backing bean, so that when the page is rendered the default choice is marked. How can i do this?
    <h:selectManyCheckbox value="#{myBean.selectedItems}"  converter="MyConverter" >
                               <f:selectItems value="#{myBean.allItems}"/>
    </h:selectManyCheckbox>

    well the component is linked to your backing bean property 'myBean.selectedItems', which is probably a list or something. Whatever value in this list is true will be checked, so make the 'default' one true when you initially create the list (for example, in a @PostConstruct annotated method).

  • Export/Import the mapping value used in Value Mapping Function

    I used value mapping function, so I defined some mapping data at Integration Directory. now I need migration from development xi to production xi, so How to export the data I input at development xi and later import it? or anyone could provide other solution for replacing value mapping function?
    Hope from your helps
    Thanks
    Spring
    Message was edited by: Spring Tang
    Message was edited by: Spring Tang
    Message was edited by: Spring Tang

    Hi Spring Tang,
      You can export your mapping object in .mte format.
      For this press ctrl+shift and right click in the
      mapping editor. Then go to tools and export the same.
      Similarly you can import the mapping object.
      Hope this will solve your problem.
      Thanks and Regards
      Vishal Kumar

  • AudiCLip.play should return a boolean value

    Java Experts,
    looks like it's a bug in java, the audioClip.play method should return a boolean value indicating whether it was able to play the clip or not. Because sometimes the method doesn't play anything. Right now the method plays asynchronously that may be the reason that it returns a void. Thoughts???
    Q.

    i agree with you..i also encountered this problem sometimes the play method doesn't play and the programmer has no clue to figure this out programmetically...Looks like this problem has no solution..where are java experts in this forum??

  • Newbie - How to retrieve a "Boolean" value in a jsp via jsf ?

    Is it possible to retrieve a Boolean value from a BBean from, from let's say a 'rendered' tag ?
    class BBean
    Boolean secure;
    public Boolean getSecure() {...}
    From the jsf:
    <h:outputText value="#{somebean.whatever}" rendered="#{BBean.? == false}" />
    How do I use the Boolean object in an expression like the one above ?
    Note: I've simplified the example above, but I cannot use a primitive boolean for this, the objects I use
    are generated with "Boolean"s and I have no control.
    Thanks in advance !
    Mark

    You should just use boolean instead of Boolean;
    class BBean
    boolean secure;
    public boolean getSecure() {...}
    <h:outputText value="#{somebean.whatever}" rendered="#{bBean.secure == false}" />

  • [Insert in to table with the values of function]

    Hi,
    I was written the following procedure in my DB to get the values of bonuses and id from the table employee_290512
    create or replace procedure ins_desc is
    cursor i1 is
    select id, decode (description,'Tester',salary*15,'Programmer',salary*30,'Manager',salary*30) bonus from employee_290512;
    v_id employee_290512.id%type;
    v_bonus employee_290512.salary%type;
    Begin
    open i1;
    loop
    fetch i1 into v_id,v_bonus;
    exit when i1% notfound;
    dbms_output.put_line (v_id || ' '||v_bonus);
    end loop;
    close i1;
    end;
    I written the following function by calling the above procedure inside the function to achieve the result like this
    create or replace function bon_chk return number
    is
    v_result number;
    begin
    ins_desc;
    return v_result;
    end;
    I written the above two stuffs to insert the output values of function in to the table called bonuses_proc having the values (id,bonus)
    To achieve the above I executed the following query
    insert into bonuses_proc (employee_id,bonus) select bon_chk from dual;
    During the above it throws the error ORA-00947: not enough values
    i understand the function return the v_result as onve value so it throws the above error
    Could any one please clarify me on this?
    Regards
    Thelak
    Edited by: thelakbe on Jun 5, 2012 12:00 PM
    Edited by: thelakbe on Jun 5, 2012 12:01 PM
    Edited by: thelakbe on Jun 5, 2012 12:01 PM

    Hi,
    yes we can do like above too, but i dont want to give the insert permission to the table to all the user,so is there any possiblities do it with ouput of function?If you would use the output of the function (if it had two values) you also need to do the insert as you tried to do in the initial post:
    insert into bonuses_proc (employee_id,bonus) select bon_chk from dual;If you do not want insert permisions on a table for a user then you can put the whole SQL in a procedure in a schema with insert permisions and give the user exec rigth to that procedure.
    The procedure can be like:
    create or replace
    procedure insert_bonus authid definer as
    begin
    insert into bonuses_proc (employee_id,bonus)
    SELECT
      id
      ,DECODE (description, 'Tester', salary*15, 'Programmer', salary*30, 'Manager', salary*30) bonus
    FROM
      employee_290512;
    end;regards,
    Peter

Maybe you are looking for

  • Bpm 11g with ADF R2 UI  for Human Workflow UI

    Hi Would like to check if it is possible to develop the ui conponent of an bpm 11g flow in Adf R2, and integrate the developed ui using bpm workspace?

  • Issue Installing Adobe Flash Latest Version 13.0.0.201 On iMac 2.7 GHz i5 core 8 GB OS X 10.9.2?

    I am trying to install the latest version of flash 13.0.0.201. I am getting errors.  I followed all instructions and increased offline hd space.  I removed previous version of flash. I have 999.35 GB Hard drive with 953.55 GB available. Any other ide

  • Ripping in Apple lossless, random beeps in file created. genius bar no help

    Just began downloading my CDs to an external firewire drive attached to my new Macbook w/ Leopard, using iTunes w/ Apple Lossless. This will be for my hi-fi stereo. I'm using the latest versions of all software. After about a dozen CDs, I have done s

  • SSD replacement

    Dear all, I would like to ask, is there any problem if i replace my ssd for macbook air 2012 to ssd for macbook air 2013? Is that still readable? or some failure might be happened? For your information currently i am using macbook air 2012, with ssd

  • Transparent stage/background

    Sorry if I've asked this before! brain like a goldfish at the moment. But can we set the stage to transparent. I need to bring in an animation to indesign that will sit on top of other elements, so the oam file needs to have transparency. Cheers Alis