OK, lets get a few things sorted out.
Youre using Oracle (assuming something recent like 11gR2), but nothing youre doing is very version specific.
First, youre gening up a table. That code is directly supplied. Same for the population statements for that table - thats a direct copy and paste.
Are you getting your table and your data populated? Im assuming the instructor has walked you through setting up SQLDeveloper? (Thats an Oracle freeware GUI for Oracle management and development, actually Java based).
The task is to create a package, which is a bundle of Stored Procs with a header section that defines the interfaces for the prods. Youre going to be using PL/SQL which is Oracles DB programming language (Procedural Language SQL).
Id take it a step at a time.
Create the table.
Populate the table.
Run some basic queries against the table like select <columns) from schema.tablename;
Then develop your stored procs before bundling them into a package.
For example (note this isnt complete):
Code:
CREATE OR REPLACE PROCEDURE <your_schema>.ADD_CUSTOMER
/*
Name: AddCustomer
Function: Adds customer record
Version: 1.0
*/
(
p_id NUMBER,
p_firstname VARCHAR2
)
AS
BEGIN
INSERT INTO <your_schema>.cust
( cust_id,
cust_firstname
)
VALUES
( p_id,
p_firstname
);
END;
Thats a super basic stored proc that you can use to test your simple SQL logic, parameters, etc.
Then youll eventually migrate this into a package like so:
Code:
CREATE PACKAGE <your_schema>.customer
IS
PROCEDURE ADD_CUSTOMER
(
p_id NUMBER,
p_firstname VARCHAR2
);
END;
/
And youll migrate your proc code to a package body:
Code:
CREATE PACKAGE BODY <your_schema>.ADD_CUSTOMER
IS
/*
Name: AddCustomer
Function: Adds customer record
Version: 1.0
*/
(
p_id NUMBER,
p_firstname VARCHAR2
)
BEGIN
INSERT INTO <your_schema>.cust
( cust_id,
cust_firstname
)
VALUES
( p_id,
p_firstname
);
END;
Again, this is off the top of my head, so this may not work if just C&Ped into SQLDeveloper.
Just trying to give you a starting point.
