100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Other

INF assignment 3 solutions

Rating
-
Sold
6
Pages
8
Uploaded on
04-07-2023
Written in
2022/2023

Contains precise solutions for the 3rd assignment

Institution
Course









Whoops! We can’t load your doc right now. Try again or contact support.

Connected book

Written for

Institution
Course

Document information

Uploaded on
July 4, 2023
Number of pages
8
Written in
2022/2023
Type
Other
Person
Unknown

Subjects

Content preview

INF3707 2023 ASSIGNMENT 3
SOLUTIONS

Crystal Indigo!
Crystal Indigo!
Providing all solutions you need anytime
+27 76 626 8187

, Question 1 Chapter 6
1.1 Create a sequence that generates integers starting with the value
5. Each value should be three less than the previous value generated.
The lowest value should be 0, and the sequence should not be allowed
to cycle. Name the sequence MY_FIRST_SEQ.
CREATE SEQUENCE MY_FIRST_SEQ
INCREMENT BY -3
START WITH 5
MAXVALUE 5
MINVALUE 0
NOCYCLE;

1.2 Issue a SELECT statement that displays NEXTVAL for
MY_FIRST_SEQ three times. Since the value is not being stored in the
table, use dual table in the FROM clause of the SELECT statement. What
caused the error on the third SELECT?
SELECT MY_FIRST_SEQ.NEXTVAL
FROM DUAL;
you would encounter an error similar to "ORA-08002: sequence MY_FIRST_SEQ.NEXTVAL
exceeds MAXVALUE and cannot be instantiated." This error occurs because the sequence has
reached its maximum value and cannot generate a new value.

1.3 Evaluate the SQL commands


Generally the error is being caused when working with SYSDATE, the table is checking the
expiry_date with SYSDATE. So each time when the system date change it will not be validated.
create table ord_items
(ord_no NUMBER(4) DEFAULT ord_seq.ord_seq.NEXTVAL NOT NULL,
Item_no NUMBER(3),
qty NUMBER(3) CHECK (qty BETWEEN 100 AND 200),
todays_date date DEFAULT SYSDATE,
expiry_date date ,
CONSTRAINT its_pky PRIMARY KEY (ord_no,Item_no),
CONSTRAINT ord_fky FOREIGN KEY (ord_no) references orders(order#),
CONSTRAINT check_expiry CHECK(expiry_date> todays_date));

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
CrystalIndigo University of South Africa (Unisa)
Follow You need to be logged in order to follow users or courses
Sold
486
Member since
5 year
Number of followers
226
Documents
73
Last sold
1 month ago
CrystalIndigo Solutions

providing all solutions to all computer science modules

4.1

51 reviews

5
27
4
13
3
6
2
1
1
4

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions