Oracle: text output from procedures (Tricky ;)

From: Date: Tue, 15 Aug 2000 12:28:55 +0000
Subject: Oracle: text output from procedures (Tricky ;)
Groups: php.db 
Request: Send a blank email to php-db+get-2062@lists.php.net to get a copy of this message
Hi, Bit of a tricky one this! Idea: I want to move all the delete checking of out php and into an Oracle procedure; so something along the lines of: <?php /* run_sql() takes care of login, parse,excute...etc... */ $result = run_sql("begin p_delete_category($catid); end;") /* and returns results of OCIError() */ if ($result == FALSE) { echo "$catid sucessfully deleted<br>\n"; } else { echo "Unable to delete $catid: $result['message']<br>\n"; } ?> Inside Oracle I have a procedure which checks for several conditions before the delete (note: I can not use a trigger because the trigger would be mutating!): procedure p_delete_category(p_cat_seqno in number) is cursor con_docs is select count(*) from categories where cat_parent_seqno = p_cat_seqno; l_docs := number; begin open con_docs; fetch con_docs into l_docs; close con_docs; -- -- This bit -- if l_docs > 0 then output "can not delete: contains category children"; return bad; endif; -- -- condition 2 -- delete from categories where cat_seqno = p_cat_seqno; return good; end; Basically I would like to output though php why the procedure could not run to completion. A work mate suggested that "set serveroutput on" and dbms_output.(putline,new_line,...) may help. Is there any way of making this work, or are there any user definable error messages that can be used. Any ideas, I'm stuck? Regards, David.

« previous php.db (#2062) next »