COSC 641 Spring 2007 FSU SEQUENCE PRACTICE “TEST” is an Oracle user account 1 – Check data in table Patient SELECT * FROM Test.Patient; 2 – a. Check to see the list of existing sequences (what do you see and why?)) SELECT Sequence_Name FROM SEQ; --USER_SEQUENCES b. SELECT * FROM SEQ; 3 – a. Check to see what the current value of sequence P_Seq is. b. Check to see what the next value of sequence P_Seq is. 4 – Insert one row of data into table Patient.(use P_Seq for AddMin field) 5 – Check the current value of sequence P_Seq. 6 – Display the number of rows, and the current value of the sequence from table Patient. (What is your conclusion?) 7– a-What are the results of this query and why? SELECT Test.P_Seq.CURRVAL, Test.P_Seq.NEXTVAL, Test.P_Seq.NEXTVAL, Test.P_Seq.CURRVAL FROM DUAL; 8- Check data in table Patient SELECT * FROM Test.Patient; 9 – Create a “Temp10” table with the following fields: Num NUMBER Year NUMBER Name VARCHAR2 (25) SerialNo NUMBER 10 – Create a sequence called MySeq; that produce odd numbers. 11 – Check the sequence name, increment by value, cycle flag and last number stored in the database.(compare the last number with MySeq.CURRVAL) *12 – Create a script to add a record into table Temp10 with Num = MySeq, Year = 2006, Names, and SerialNo = SerialNo + 1 (Do not use sequence for SerialNo) 13 – Add two records using the script created in 12. 14 – Display how many records exist in Temp10. 15 – Compare the count, last SerialNo, and CurrVal. 16 – Display Year and Num (example 2006–5000) in one field, Name, SerialNo for each row. *17 – We would like the next sequence number (MySeq) to be 351; Modify your sequence. (Do not drop and create the sequence) 18 – Insert a row in Temp10 table using script created in 12 19 – Examine your data in table Temp10