I already have the create table and create sequence part complete I just
actually need help with the insert part.  I have never worked with a
sequence.

I have this much can anyone tell me if I am heading in the right
direction and if so feel free to throw in any thing to help put me in
the correct direction.

CREATE SEQUENCE "DeptCodeSeq"
INCREMENT BY 20
START WITH 1000
MAXVALUE 9080
NOCYCLE;

CREATE TABLE "Departments"
                ("DeptCode" NUMBER(4),
                 "Name" VARCHAR2(30),
                 "DeptSize" NUMBER(5));


DECLARE


V_DeptCode "DeptCodeSeq".nextval%type;
v_Name      varchar2(30);
v_DeptSize  number(5);


BEGIN







END

-----Original Message-----
From: Joshua Tipton [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, April 21, 2002 6:59 PM
To: CF-Talk
Subject: Oracle Gurus

I would be at anyone's mercy if they could do this for me.

 

1.        Create a sequence DeptCodeSeq to generate dept codes in the
range 

 

1000, 1020, 1040, . .., 9080

 

Create table called Departments that has the following columns in it.

 


DeptCode

Name

DeptSize


NUMBER(4)

VARCHAR2(30)

NUMBER(5)

 

Create a PL/SQL anonymous block called  POPDEPTS.sql  (Populate
Department )
using  FOR .. LOOP that uses the DeptCodeSeq to generate the department
code
and the name

Where the name is constructed as DEPT-1020 DEPT-1040, and so on. That is
the
name of the department is the concatenation of "DEPT-" and the
department
code generated by the sequence. As each row is inserted print out the
department t code and department name delimited by ';' on a separate
line. (
use the DBMS_OUTPUT.PUT_LINE ).

 

 

When testing your code you may need to constantly drop your sequence and
create it until your PL/SQL block works correctly.

 

DECLARE

............

...........

BEGIN

 

Your code goes here

( you need  FOR .. LOOP statement )

END;

 

2.        Create a PL/SQL block to delete from Departments the
departments
that have their name ending in 40 and 80 digits.

            

   

 

 




______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to