Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Oracle SQL Create an application that will upload student information to the \"S

ID: 3717845 • Letter: O

Question

Oracle SQL

Create an application that will upload student information to the "StudentRecord" database that was created in Project1.  The application must perform the following.

       Create a table "StudentRecord" that contains fields, FirstName, LastName, DateOfBirth (Date datatype)and Photo (BFILE datatype)

      Create a directory, "C:Temp", and download five "jpeg" files that contains photographs for individuals.  Files must be named "pict1.jpg" - "pict5.jpg"

·         Write an Anonymous PL/SQL block that will insert five records into the database; the records must include the "jpeg" binary files that contains the photographs associated with each record.  One technique would be,

Create BFILE locators for each of the image files

Create 5 INSERT statements into the table

Explanation / Answer

Answer:

Create table called StudentRecord.

CREATE TABLE StudentRecord (FirstName VARCHAR2(20),LastName VARCHAR2(20),DateOfBirth DATE,Photo BFILE);

DECLARE

Lob_loc1 BFILE := BFILENAME('C:Temp', 'pict1.jpg');

Lob_loc2 BFILE := BFILENAME('C:Temp', 'pict2.jpg');

Lob_loc3 BFILE := BFILENAME('C:Temp', 'pict3.jpg');

Lob_loc4 BFILE := BFILENAME('C:Temp', 'pict4.jpg');

Lob_loc5 BFILE := BFILENAME('C:Temp', 'pict5.jpg');

BEGIN

INSERT INTO StudentRecord (FirstName, LastName, DateOfBirth, Photo) VALUES ('Studentfname1', 'Studentlname1', '08-AUG-96', Lob_loc1);

INSERT INTO StudentRecord (FirstName, LastName, DateOfBirth, Photo) VALUES ('Studentfname2', 'Studentlname2', '13-JAN-91' Lob_loc2);

INSERT INTO StudentRecord (FirstName, LastName, DateOfBirth, Photo) VALUES ('Studentfname3', 'Studentlname3', '20-FEB-89' Lob_loc3);

INSERT INTO StudentRecord (FirstName, LastName, DateOfBirth, Photo) VALUES ('Studentfname4', 'Studentlname4', '30-FEB-88' Lob_loc4);

INSERT INTO StudentRecord (FirstName, LastName, DateOfBirth, Photo) VALUES ('Studentfname5', 'Studentlname5', '29-AUG-86' Lob_loc5);

COMMIT;

END;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote