could i get some help with this problem???

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

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

Howdy, Stranger!

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

Categories