par
Invité » 18 avr. 2006, 14:51
voila le code sur le quel je me suis bassé
<?php
// Changed connection details to suit my environment
$connection = ora_logon("scott@MYDB", "tiger");
$cursor = ora_open($connection);
ora_commitoff($connection);
// Changed schema to SCOTT to match who I'd created the procedure as
$cu=ora_parse($cursor, "begin SCOTT.kunde_create ( :Sta_nameD, :Sta_name2D, :Sta_kugruD, :ianredeD, :Sta_straD, :Sta_landD, :Sta_plzD, :Sta_ortD, :Sta_ortsteilD, :Sta_telD, :Sta_mailD, :Sta_faxD, :Sta_tel2D, :Sta_anruD, :Sta_zusD, :Sta_zus2D ,:okdnr); end;");
// Allocated the IN parameter variables
$Sta_nameD = 'a';
$Sta_name2D = 'a';
$ianredeD = 1;
$Sta_straD = 'a';
$Sta_landD = 'a';
$Sta_plzD = 'a';
$Sta_ortD = 'a';
$Sta_ortsteilD = 'a';
$Sta_telD = 'a';
$Sta_mailD = 'a';
$Sta_faxD = 'a';
$Sta_tel2D = 'a';
$Sta_anruD = 'a';
$Sta_zusD = 'a';
$Sta_zus2D = 'a';
$Sta_kugruD = 'a';
// Changed ora_bind syntax to match
// http://www.php.net/manual/en/function.ora-bind.php
ora_bind($cursor, "Sta_nameD", ":Sta_nameD", 32, 1);
ora_bind($cursor, "Sta_name2D", ":Sta_name2D", 32, 1);
// Change ianredeD type to 2 to match procedure definition
ora_bind($cursor, "ianredeD", ":ianredeD", 32, 2);
ora_bind($cursor, "Sta_straD", ":Sta_straD", 32, 1);
ora_bind($cursor, "Sta_landD", ":Sta_landD", 32, 1);
ora_bind($cursor, "Sta_plzD", ":Sta_plzD", 32, 1);
ora_bind($cursor, "Sta_ortD", ":Sta_ortD", 32, 1);
ora_bind($cursor, "Sta_ortsteilD", ":Sta_ortsteilD", 32, 1);
ora_bind($cursor, "Sta_telD", ":Sta_telD", 32, 1);
ora_bind($cursor, "Sta_mailD", ":Sta_mailD", 32, 1);
ora_bind($cursor, "Sta_faxD", ":Sta_faxD", 32, 1);
ora_bind($cursor, "Sta_tel2D", ":Sta_tel2D", 32, 1);
ora_bind($cursor, "Sta_anruD", ":Sta_anruD", 32, 1);
ora_bind($cursor, "Sta_zusD", ":Sta_zusD", 32, 1);
ora_bind($cursor, "Sta_zus2D", ":Sta_zus2D", 32, 1);
// Changed okdnr type to 1 to match procedure definition
ora_bind($cursor, "okdnr", ":okdnr", 32, 1);
// Bound missing parameter
ora_bind($cursor, "Sta_kugruD", ":Sta_kugruD", 32, 1);
// Preallocated the output variable - I'm not sure why this is
// necessary nor what size is needed.
// When this line is commented out I get:
// Warning: Can't find variable for parameter in test01.php on line XX
$okdnr = "a";
ora_exec($cursor);
print "okdnr is $okdnr";
?>
voila le code sur le quel je me suis bassé
[php]
<?php
// Changed connection details to suit my environment
$connection = ora_logon("scott@MYDB", "tiger");
$cursor = ora_open($connection);
ora_commitoff($connection);
// Changed schema to SCOTT to match who I'd created the procedure as
$cu=ora_parse($cursor, "begin SCOTT.kunde_create ( :Sta_nameD, :Sta_name2D, :Sta_kugruD, :ianredeD, :Sta_straD, :Sta_landD, :Sta_plzD, :Sta_ortD, :Sta_ortsteilD, :Sta_telD, :Sta_mailD, :Sta_faxD, :Sta_tel2D, :Sta_anruD, :Sta_zusD, :Sta_zus2D ,:okdnr); end;");
// Allocated the IN parameter variables
$Sta_nameD = 'a';
$Sta_name2D = 'a';
$ianredeD = 1;
$Sta_straD = 'a';
$Sta_landD = 'a';
$Sta_plzD = 'a';
$Sta_ortD = 'a';
$Sta_ortsteilD = 'a';
$Sta_telD = 'a';
$Sta_mailD = 'a';
$Sta_faxD = 'a';
$Sta_tel2D = 'a';
$Sta_anruD = 'a';
$Sta_zusD = 'a';
$Sta_zus2D = 'a';
$Sta_kugruD = 'a';
// Changed ora_bind syntax to match
// http://www.php.net/manual/en/function.ora-bind.php
ora_bind($cursor, "Sta_nameD", ":Sta_nameD", 32, 1);
ora_bind($cursor, "Sta_name2D", ":Sta_name2D", 32, 1);
// Change ianredeD type to 2 to match procedure definition
ora_bind($cursor, "ianredeD", ":ianredeD", 32, 2);
ora_bind($cursor, "Sta_straD", ":Sta_straD", 32, 1);
ora_bind($cursor, "Sta_landD", ":Sta_landD", 32, 1);
ora_bind($cursor, "Sta_plzD", ":Sta_plzD", 32, 1);
ora_bind($cursor, "Sta_ortD", ":Sta_ortD", 32, 1);
ora_bind($cursor, "Sta_ortsteilD", ":Sta_ortsteilD", 32, 1);
ora_bind($cursor, "Sta_telD", ":Sta_telD", 32, 1);
ora_bind($cursor, "Sta_mailD", ":Sta_mailD", 32, 1);
ora_bind($cursor, "Sta_faxD", ":Sta_faxD", 32, 1);
ora_bind($cursor, "Sta_tel2D", ":Sta_tel2D", 32, 1);
ora_bind($cursor, "Sta_anruD", ":Sta_anruD", 32, 1);
ora_bind($cursor, "Sta_zusD", ":Sta_zusD", 32, 1);
ora_bind($cursor, "Sta_zus2D", ":Sta_zus2D", 32, 1);
// Changed okdnr type to 1 to match procedure definition
ora_bind($cursor, "okdnr", ":okdnr", 32, 1);
// Bound missing parameter
ora_bind($cursor, "Sta_kugruD", ":Sta_kugruD", 32, 1);
// Preallocated the output variable - I'm not sure why this is
// necessary nor what size is needed.
// When this line is commented out I get:
// Warning: Can't find variable for parameter in test01.php on line XX
$okdnr = "a";
ora_exec($cursor);
print "okdnr is $okdnr";
?>
[/php]