Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

could i get some help with this problem???

tonybar2tonybar2 Member Posts: 72
Write a function and pass a department number to it . If the DEPT table does noet contain that department number, return a false value, otherwise return a true value. Print the appropriate message in the calling program based on the result.

I'm not sure how to do this??

Comments

  • David MartinDavid Martin Member Posts: 2
    This sounds like a homework question so I am not going to give a 'full' answer. But follow these steps. Create a function (CREATE OR REPLACE FUNCTION - read any Oracle site online for the syntax) and specify the RETURN as BOOLEAN. Put a RETURN(TRUE) in it. Call it from SQL*Plus (SELECT decode(my_function,TRUE,'TRUE','FALSE') from dual;) you should get a 'TRUE'. Now add an input parameter (read book again) and create a CURSOR that uses the inpit parameter, do an OPEN, FETCH, %NOTFOUND, CLOSE cursor combo (read book again). If notfound return false else return true.

    Enjoy.
  • tonybar2tonybar2 Member Posts: 72
    : This sounds like a homework question so I am not going to give a 'full' answer. But follow these steps. Create a function (CREATE OR REPLACE FUNCTION - read any Oracle site online for the syntax) and specify the RETURN as BOOLEAN. Put a RETURN(TRUE) in it. Call it from SQL*Plus (SELECT decode(my_function,TRUE,'TRUE','FALSE') from dual;) you should get a 'TRUE'. Now add an input parameter (read book again) and create a CURSOR that uses the inpit parameter, do an OPEN, FETCH, %NOTFOUND, CLOSE cursor combo (read book again). If notfound return false else return true.
    :
    : Enjoy.
    :
    yes you are right this is a homework assignment, one of twenty problems anyways, if you could show me the code to this one i could figure out the others. thankyou kindly!!!!
Sign In or Register to comment.