To all who offered there help :
A big thanks, I've got this about 70% licked now
:)
The winning combination was :
CREATE OR REPLACE FUNCTION check_for_name2 (p_name_to_check VARCHAR) RETURN VARCHAR2 IS v_data VARCHAR2(20); v_return_value VARCHAR2(20); BEGIN SELECT lname INTO v_data FROM names WHERE lname = p_name_to_check; RETURN 'Found'; EXCEPTION WHEN no_data_found THEN RETURN 'No Matches'; END check_for_name2; Thanks to Lisa for the help there. However, the attempts to do the same with the cursor continue to fail: CREATE OR REPLACE FUNCTION check_for_name (p_name_to_check VARCHAR) RETURN VARCHAR2 IS CURSOR c_namestbl IS SELECT lname, fname FROM names WHERE lname = p_name_to_check; v_return_value VARCHAR2(20); BEGIN OPEN c_namestbl; IF c_namestbl%NOTFOUND = TRUE THEN v_return_value := 'Not here'; ELSIF C_namestbl%FOUND = FALSE THEN v_return_value := 'In Here'; END IF; CLOSE c_namestbl; RETURN v_return_value; EXCEPTION WHEN no_data_found THEN RETURN 'No Matches'; END check_for_name; While I can get it to execute with "Select check_for_name('Cruise') FROM dual;" it returns no data, but looks like it wants to: SQL> SELECT check_for_name('Cruise') FROM dual; CHECK_FOR_NAME('CRUISE')
If anybody has any ideas on that one, thankyou. But try to structure your answer in the form of 'hints' that way I get to do something instead of have type what I'm told... can't learn that way.
Thanks again to all for your responses.
|
- RE: Can't code for s.... peanuts Vadim Gorbounov
- RE: Can't code for s.... peanuts Jamadagni, Rajendra
- RE: Can't code for s.... peanuts Koivu, Lisa
- Re: Can't code for s.... peanuts William Beilstein
- RE: Can't code for s.... peanuts Norrell, Brian
- Re: Can't code for s.... peanuts JOE TESTA
- RE: Can't code for s.... peanuts schmoldt
- RE: Can't code for s.... peanuts Yadav, Shailesh
- Re: Can't code for s.... peanuts Dennis M. Heisler
- RE: Can't code for s.... peanuts John Lewis
- RE: Can't code for s.... peanuts
- RE: Can't code for s.... peanuts Mercadante, Thomas F
- RE: Can't code for s.... peanuts Yadav, Shailesh
- RE: Can't code for s.... peanuts Kevin Lange
- Re: Can't code for s.... peanuts