How do I get movie attributes into the table? 21c
[How do I add video attributes to the table
Use Oracle 21c](https://www.stackoverflow.com/)
I Have a table :
CREATE TABLE tvid (
n NUMBER,
vid BLOB,
attributes CLOB,
mimetype VARCHAR2(80),
filename VARCHAR2(500),
vid_duration INTEGER,
bitrate INTEGER
)
LOB ( vid ) STORE AS SECUREFILE;
create a directory object:
CREATE OR REPLACE DIRECTORY vid_DIR AS 'D:\videos';
GRANT READ,WRITE ON DIRECTORY vid_DIR TO mediauser;
You insert data >> vid1.MP4:
SET SERVEROUTPUT ON;
DECLARE
f_lob BFILE := BFILENAME( 'vid_DIR', 'vid1.MP4');
b_lob BLOB;
BEGIN
INSERT INTO TAUD (N,vid,attributes )
VALUES ( 1, EMPTY_BLOB(),EMPTY_CLOB());
SELECT vid INTO b_lob FROM TAUD WHERE N=1 FOR UPDATE;
-- open the bobs.
DBMS_LOB.open(f_lob, DBMS_LOB.file_readonly);
DBMS_LOB.open(b_lob, DBMS_LOB.lob_readwrite);
-- populate the BLOB from the audio file in the BFILE.
DBMS_LOB.loadfromfile(b_lob, f_lob, DBMS_LOB.getlength(f_lob));
-- close the LOBs;
DBMS_LOB.close(b_lob);
DBMS_LOB.close(f_lob);
COMMIT;
END;
My question:How do i add video attributes to the table?
SET SERVEROUTPUT ON;
DECLARE
aud_data BLOB;
mimetype VARCHAR2(80);
format VARCHAR2(32) := NULL;
encoding VARCHAR2(160);
numberofchannels NUMBER;
samplingrate NUMBER;
samplesize NUMBER;
compressiontype VARCHAR2(160);
audioduration NUMBER;
BEGIN
SELECT
aud,
mimetype,
format,
encoding,
numberofchannels,
samplingrate,
samplesize,
compressiontype,
audioduration
INTO
aud_data,
mimetype,
format,
encoding,
numberofchannels,
samplingrate,
samplesize,
compressiontype,
audioduration
FROM
taud
WHERE
n = 4
FOR UPDATE;
ordsys.ordaudio.getproperties(aud_data, mimetype, format, encoding, numberofchannels,
samplingrate, samplesize, compressiontype, audioduration);
-- print properties
dbms_output.put_line('mimeType: ' || mimetype);
dbms_output.put_line('format: ' || format);
dbms_output.put_line('encoding: ' || encoding);
dbms_output.put_line('numberOfChannels: ' || numberofchannels);
dbms_output.put_line('samplingRate: ' || samplingrate);
dbms_output.put_line('sampleSize: ' || samplesize);
dbms_output.put_line('compressionType: ' || compressiontype);
dbms_output.put_line('audioDuration: ' || audioduration);
UPDATE taud
SET
aud = aud_data,
mimetype = mimetype,
format = format,
encoding = encoding,
numberofchannels = numberofchannels,
samplingrate = samplingrate,
samplesize = samplesize,
compressiontype = compressiontype,
audioduration = audioduration
WHERE
n = 4;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END;
Script output: Error report - ORA-06550: سطر 38 ، عمود 16 : PLS-00306: wrong number or types of arguments in call to 'GETPROPERTIES' ORA-06550: سطر 38 ، عمود 16 : PL/SQL: Statement ignored 06550. 00000 - "line %s, column %s:\n%s" *Cause: Usually a PL/SQL compilation error. *Action:
Comments
Post a Comment