AW: [PHP-DB] Oracle Function Calls
YOu have to form proper SQL-Statements try to parse and execute: select foo_function ('paramstr', 999) from dual; dual is a dummy table; then fetch the resultrow and ociresult($stmt, 1) will return your functionreturnvalue mk -Ursprungliche Nachricht- Von: Richard S. Crawford [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 7. Marz 2001 22:11 An: [EMAIL PROTECTED] Betreff: [PHP-DB] Oracle Function Calls Ah! My bad! I sent this question out with the wrong subject line. My apologies to everyone that I confused. At 01:07 PM 3/7/01 -0800, Richard S. Crawford wrote: I desperately need to know whether it is possible to call an Oracle function in PHP. For example... $functionResult=hubins($name,$commit_yn) where hubins is a stored procedure in our Oracle database. Can this be done? My first thought was to do something like this: $functionCall="hubins($name,$commit_yen)"; then then do ociexecute($functionCall); ...but that, of course didn't work. Any thoughts? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- http://www.mossroot.com/index.php AIM Handle: Buffalo2K e-mail: [EMAIL PROTECTED] "When you lose the power to laugh at yourself, you lose the power to think straight." --Clarence Darrow -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: AW: [PHP-DB] Oracle Function Calls
Here is the error that I get when I try this approach: ORA-14551: cannot perform a DML operation inside a query At 10:26 PM 3/7/01 +0100, Matthias Kopolt wrote: YOu have to form proper SQL-Statements try to parse and execute: select foo_function ('paramstr', 999) from dual; dual is a dummy table; then fetch the resultrow and ociresult($stmt, 1) will return your functionreturnvalue mk -Ursprungliche Nachricht- Von: Richard S. Crawford [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 7. Marz 2001 22:11 An: [EMAIL PROTECTED] Betreff: [PHP-DB] Oracle Function Calls Ah! My bad! I sent this question out with the wrong subject line. My apologies to everyone that I confused. At 01:07 PM 3/7/01 -0800, Richard S. Crawford wrote: I desperately need to know whether it is possible to call an Oracle function in PHP. For example... $functionResult=hubins($name,$commit_yn) where hubins is a stored procedure in our Oracle database. Can this be done? My first thought was to do something like this: $functionCall="hubins($name,$commit_yen)"; then then do ociexecute($functionCall); ...but that, of course didn't work. Any thoughts? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- http://www.mossroot.com/index.php AIM Handle: Buffalo2K e-mail: [EMAIL PROTECTED] "When you lose the power to laugh at yourself, you lose the power to think straight." --Clarence Darrow -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- http://www.mossroot.com/index.php AIM Handle: Buffalo2K e-mail: [EMAIL PROTECTED] "When you lose the power to laugh at yourself, you lose the power to think straight." --Clarence Darrow -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
AW: AW: [PHP-DB] Oracle Function Calls
Oracle Divides Function in several Groups DML means Data-Manipulating function; (in your funciton is a update or insert) to use a function in a query it needs to be "pure" only selects and arithmetics you can rewrite this function to a procedure and return your value as an out parameter $stmt = ociparse($dbh,"BEGIN p_foo_procedure('param_in',:1);END;" ); OCIBindByName ($stmt,":1",$outparam,40); ociexecute ($stmt); OCIfreestatement($stmt); 40 is the buffer in chars/bytes (addjust if needed) the procedure needs to declare the second argument as in and can declare the second one as "out" or "in out" mk -Ursprungliche Nachricht- Von: Richard S. Crawford [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 7. Marz 2001 22:46 An: [EMAIL PROTECTED] Betreff: Re: AW: [PHP-DB] Oracle Function Calls Here is the error that I get when I try this approach: ORA-14551: cannot perform a DML operation inside a query At 10:26 PM 3/7/01 +0100, Matthias Kopolt wrote: YOu have to form proper SQL-Statements try to parse and execute: select foo_function ('paramstr', 999) from dual; dual is a dummy table; then fetch the resultrow and ociresult($stmt, 1) will return your functionreturnvalue mk -Ursprungliche Nachricht- Von: Richard S. Crawford [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 7. Marz 2001 22:11 An: [EMAIL PROTECTED] Betreff: [PHP-DB] Oracle Function Calls Ah! My bad! I sent this question out with the wrong subject line. My apologies to everyone that I confused. At 01:07 PM 3/7/01 -0800, Richard S. Crawford wrote: I desperately need to know whether it is possible to call an Oracle function in PHP. For example... $functionResult=hubins($name,$commit_yn) where hubins is a stored procedure in our Oracle database. Can this be done? My first thought was to do something like this: $functionCall="hubins($name,$commit_yen)"; then then do ociexecute($functionCall); ...but that, of course didn't work. Any thoughts? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- http://www.mossroot.com/index.php AIM Handle: Buffalo2K e-mail: [EMAIL PROTECTED] "When you lose the power to laugh at yourself, you lose the power to think straight." --Clarence Darrow -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- http://www.mossroot.com/index.php AIM Handle: Buffalo2K e-mail: [EMAIL PROTECTED] "When you lose the power to laugh at yourself, you lose the power to think straight." --Clarence Darrow -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: AW: AW: [PHP-DB] Oracle Function Calls
Hm. Assuming that I don't have the option of rewriting the function to a procedure, is there another way to go? At 10:54 PM 3/7/01 +0100, Matthias Kopolt wrote: Oracle Divides Function in several Groups DML means Data-Manipulating function; (in your funciton is a update or insert) to use a function in a query it needs to be "pure" only selects and arithmetics you can rewrite this function to a procedure and return your value as an out parameter $stmt = ociparse($dbh,"BEGIN p_foo_procedure('param_in',:1);END;" ); OCIBindByName ($stmt,":1",$outparam,40); ociexecute ($stmt); OCIfreestatement($stmt); 40 is the buffer in chars/bytes (addjust if needed) the procedure needs to declare the second argument as in and can declare the second one as "out" or "in out" mk -- http://www.mossroot.com/index.php AIM Handle: Buffalo2K e-mail: [EMAIL PROTECTED] "When you lose the power to laugh at yourself, you lose the power to think straight." --Clarence Darrow -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]