Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Zad 1*/
- CREATE TABLE course(
- id_course NUMBER(10) PRIMARY KEY NOT NULL,
- name VARCHAR2(50),
- start_course DATE,
- end_course DATE,
- description VARCHAR2(100),
- price NUMBER (6,2)
- );
- INSERT INTO course VALUES (1, 'Kurs 1', '1-OCT-18', '15-OCT-18', 'Opis 1', 10);
- INSERT INTO course VALUES (2, 'Kurs 2', '2-OCT-18', '15-OCT-18', 'Opis 2', 20);
- INSERT INTO course VALUES (3, 'Kurs 3', '3-OCT-18', '15-OCT-18', 'Opis 3', 30);
- INSERT INTO course VALUES (4, 'Kurs 4', '4-OCT-18', '15-OCT-18', 'Opis 4', 40);
- INSERT INTO course VALUES (5, 'Kurs 5', '5-OCT-18', '15-OCT-18', 'Opis 5', 50);
- INSERT INTO course VALUES (6, 'Kurs 6', '6-OCT-18', '15-OCT-18', 'Opis 6', 60);
- INSERT INTO course VALUES (7, 'Kurs 7', '7-OCT-18', '15-OCT-18', 'Opis 7', 70);
- INSERT INTO course VALUES (8, 'Kurs 8', '8-OCT-18', '15-OCT-18', 'Opis 8', 80);
- INSERT INTO course VALUES (9, 'Kurs 9', '9-OCT-18', '15-OCT-18', 'Opis 9', 90);
- INSERT INTO course VALUES (10, 'Kurs 10', '10-OCT-18', '15-OCT-18', 'Opis 10', 10);
- SELECT * FROM course;
- SET SERVEROUTPUT ON;
- DECLARE
- CURSOR desc_cur IS
- SELECT description
- FROM course;
- TYPE course_desc IS TABLE OF course.description%TYPE
- INDEX BY BINARY_INTEGER;
- tab1 course_desc;
- v_counter INTEGER := 0;
- BEGIN
- FOR i IN desc_cur LOOP
- tab1(v_counter) := i.description;
- v_counter := v_counter + 1;
- END LOOP;
- DBMS_OUTPUT.PUT_LINE(tab1.count());
- DBMS_OUTPUT.PUT_LINE(tab1.first());
- DBMS_OUTPUT.PUT_LINE(tab1.last());
- END;
- /*Zad 2*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement