PL/SQL (MOSC)

MOSC Banner

upload file to oracle database

in PL/SQL (MOSC) 1 commentAnswered

Hello, I am new to databases, I would like to be able to add a sql file to a field of an Oracle 19c database table:

I have done it this way but it gave me an error, I would like to know if it is the ideal way or if there are other ways:

[oracle@baseoracle ~]$ ls
Desktop  Documents  Downloads  Music  Pictures  prueba.sql  Public  scripts  Templates  Videos

SQL> CREATE TABLE Archivos (
    ID NUMBER PRIMARY KEY,
    Nombre VARCHAR2(100),
    Contenido BLOB
);


SQL>  INSERT INTO Archivos (ID, Nombre, Contenido) VALUES (2, 'prueba.sql', EMPTY_BLOB());

1 row created.

SQL*Plus: Release 19.0.0.0.0 - Production on Tue May 7 18:59:42 2024
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Last Successful login time: Tue May 07 2024 18:47:33 -05:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> DECLARE
    v_blob BLOB;
 

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center