bonjour
j'ai une procédure stock sue une basse oracle comment je peux l'excute avec php (la syntaxe exact),
Comment faire pour recuperer les valeurs renvoyées par la procédure ?
D'avance je vous remercie pour votre aide.
Code : Tout sélectionner
Warning: ora_bind(): supplied argument is not a valid Oracle-Cursor resource in c:\program files\easyphp1-8\www\code.php on line 12
Warning: ora_bind(): supplied argument is not a valid Oracle-Cursor resource in c:\program files\easyphp1-8\www\code.php on line 13
Warning: ora_exec(): supplied argument is not a valid Oracle-Cursor resource in c:\program files\easyphp1-8\www\code.php on line 18<?
include "connect.php"
$cursor = Ora_Open ($ora_conn);
ora_commitoff($ora_conn);
$cursor=ora_parse($cursor, "begin SIH_CODE128(:var1,:varchar2); end;");
$var1 ='213295';
//line12// ora_bind($cursor, "var1", ":var1", 32, 1);
//line13 // ora_bind($cursor, "varchar2", ":varchar2", 32, 2);
$okdnr = "chainecoder";
ora_exec($cursor);
print "okdnr is $okdnr";
?>
echo($cursor);
voia ce que ca donne
Code : Tout sélectionner
Resource id #3
<?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";
?>