note 36621 added to function.ora-bind
| From: | ahmed dot adaileh at vaillant dot de | Date: | Thu, 16 Oct 2003 15:38:43 +0000 |
| Subject: | note 36621 added to function.ora-bind | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-58700@lists.php.net to get a copy of this message | ||
It was hard a little bit to understand the example above. Since it did not work properly :(
I managed to get a similar one running, the whole example is as following:
<?php
$connection = ora_logon("user@DBname", "password");
$cursor = ora_open($connection);
ora_commitoff($connection);
$cursor=ora_parse($cursor, "begin user.user_create
(:name,:surname,:street,:country,:postal,:city,:tel,:mail,:number); end;");
$name = 'a';
$surname = 'a';
$street = 'a';
$country = 'a';
$postal = 'a';
$city = 'a';
$tel = 'a';
$mail = 'a';
ora_bind($cursor, "name", ":name", 32, 1);
ora_bind($cursor, "surname", ":surname", 32, 1);
ora_bind($cursor, "street", ":street", 32, 1);
ora_bind($cursor, "country", ":country", 32, 1);
ora_bind($cursor, "postal", ":postal", 32, 1);
ora_bind($cursor, "city", ":city", 32, 1);
ora_bind($cursor, "tel", ":tel", 32, 1);
ora_bind($cursor, "mail", ":mail", 32, 1);
ora_bind($cursor, "number", ":number", 32, 2);
// The following step is to charge the output variable with an intial value (Actually still
doesn't know why? but it works like this ;-)) )
$okdnr = "a";
ora_exec($cursor);
print "okdnr is $okdnr";
?>
The called stored procedure is as following:
CREATE OR REPLACE procedure customer_create
(
iname in varchar2,
insurname in varchar2,
instreet in varchar2,
incountry varchar2,
inpostal in varchar2,
incity in varchar2,
intel in varchar2,
inemail in varchar2,
okdnr out varchar2)
is
begin
.....
..... SOME CODE ....
.....
okdnr:='something_to_output';
commit;
end customer_create;
/
The most important part of all this is the ora_bind function. Becarefull while writing the syntax
regarding the definition wether the variable is an INPUT (1) variable or an OUTPUT variable (2).
Hope this help someone!!
----
Manual Page -- http://www.php.net/manual/en/function.ora-bind.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36621
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36621&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36621&report=yes
Search -- http://master.php.net/manage/user-notes.php