<?php
//OR connect using the Oracle Instant Client
$dsn = 'oci:dbname=//192.168.50.128:1521/orcl';
$username = 'scott';
$password = 'tiger';
$pdo = new PDO($dsn, $username, $password);
$sql = "SELECT name,data FROM bindata";
$stmt = $pdo->query($sql);
while ($row = $stmt->fetch()) {
$filename = "DownLoadFiles/" . $row['NAME'];
$content = stream_get_contents($row['DATA']);
file_put_contents($filename, $content);
}
?>
CREATE TABLE "SCOTT"."BINDATA" (
"ID" NUMBER(10, 0),
"NAME" VARCHAR2(512 BYTE),
"DATA" BLOB
)
ALTER TABLE bindata ADD (
CONSTRAINT bindata_pk PRIMARY KEY ( id )
);
CREATE SEQUENCE bindata_sequence;
CREATE OR REPLACE TRIGGER bindata_on_insert BEFORE
INSERT ON bindata
FOR EACH ROW
BEGIN
SELECT
bindata_sequence.NEXTVAL
INTO :new.id
FROM
dual;
END;