存储过程:create table v_xsmx
(
ID number(10),
PRODUCTNAME varchar2(100)
);
create or replace package my_query is
type rec_xscx is record(ID number(10),
PRODUCTNAME varchar2(100));
type ref_cur1 is ref cursor return rec_xscx;
procedure q_xscx(c1 in out ref_cur1);
end;
/
create or replace package body my_query is
procedure q_xscx(c1 in out ref_cur1) is
begin
open c1 for
select ID,PRODUCTNAME from pro_product where productname like '%空调%';
end;
end;
/
variable x refcursor
execute my_query.q_xscx(:X);
print x;php代码:<?php
$conn = OCILogon('shejis','shejis','orcl');
$id = 10;$productname = "";
$zList= ocinewcursor($conn);
$stmt= oci_parse($conn,"begin :n_RetCode:=my_query. q_xscx($id, $productname,:zList);end;");oci_bind_by_name($stmt, ":n_RetCode",$n_RetCode,-1);@oci_bind_by_name($stmt, ":zList",$zList,-1,OCI_B_CURSOR);
oci_execute($stmt);oci_execute($zList);@$nrows= oci_fetch_all($stmt, $results);
if ($nrows > 0) { echo "<table border=\"1\">\n"; echo "<tr>\n"; foreach ($results as $key => $val) { echo "<th>$key</th>\n"; } echo "</tr>\n";
求高手帮帮忙
(
ID number(10),
PRODUCTNAME varchar2(100)
);
create or replace package my_query is
type rec_xscx is record(ID number(10),
PRODUCTNAME varchar2(100));
type ref_cur1 is ref cursor return rec_xscx;
procedure q_xscx(c1 in out ref_cur1);
end;
/
create or replace package body my_query is
procedure q_xscx(c1 in out ref_cur1) is
begin
open c1 for
select ID,PRODUCTNAME from pro_product where productname like '%空调%';
end;
end;
/
variable x refcursor
execute my_query.q_xscx(:X);
print x;php代码:<?php
$conn = OCILogon('shejis','shejis','orcl');
$id = 10;$productname = "";
$zList= ocinewcursor($conn);
$stmt= oci_parse($conn,"begin :n_RetCode:=my_query. q_xscx($id, $productname,:zList);end;");oci_bind_by_name($stmt, ":n_RetCode",$n_RetCode,-1);@oci_bind_by_name($stmt, ":zList",$zList,-1,OCI_B_CURSOR);
oci_execute($stmt);oci_execute($zList);@$nrows= oci_fetch_all($stmt, $results);
if ($nrows > 0) { echo "<table border=\"1\">\n"; echo "<tr>\n"; foreach ($results as $key => $val) { echo "<th>$key</th>\n"; } echo "</tr>\n";
求高手帮帮忙
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货