{"id":141,"date":"2026-03-21T06:55:25","date_gmt":"2026-03-21T06:55:25","guid":{"rendered":"https:\/\/alpeshconnect.in\/blog\/?p=141"},"modified":"2026-03-21T07:01:58","modified_gmt":"2026-03-21T07:01:58","slug":"pl-sql-rdbms-practical-exam","status":"publish","type":"post","link":"https:\/\/alpeshconnect.in\/blog\/2026\/03\/21\/pl-sql-rdbms-practical-exam\/","title":{"rendered":"Distributor &#8211; PL\/SQL RDBMS Practical Exam"},"content":{"rendered":"\n<p>A). Create SQL table with primary key and foreign key with insert 5 records. Distributor : ( Dno,d_name,phno) Item : ( Item_no,Dno,item_name,qty,rate ) <\/p>\n\n\n\n<p>B). Pl\/sql block that accept distributor no and display its details with item details be distributes.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>A) Create tables with PK, FK and insert records<\/strong><\/h1>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Create Distributor table<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">CREATE TABLE Distributor (<br>    Dno NUMBER PRIMARY KEY,<br>    d_name VARCHAR2(50),<br>    phno VARCHAR2(15)<br>);<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Create Item table (with Foreign Key)<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">CREATE TABLE Item (<br>    Item_no NUMBER PRIMARY KEY,<br>    Dno NUMBER,<br>    item_name VARCHAR2(50),<br>    qty NUMBER,<br>    rate NUMBER,<br>    CONSTRAINT fk_distributor<br>    FOREIGN KEY (Dno)<br>    REFERENCES Distributor(Dno)<br>);<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Insert 5 records into Distributor<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">INSERT INTO Distributor VALUES (1, 'Raj Traders', '9876543210');<br>INSERT INTO Distributor VALUES (2, 'Shiv Supplies', '9123456780');<br>INSERT INTO Distributor VALUES (3, 'Om Distributors', '9988776655');<br>INSERT INTO Distributor VALUES (4, 'Krishna Agency', '9090909090');<br>INSERT INTO Distributor VALUES (5, 'Ganesh Traders', '9111222333');<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Insert 5 records into Item<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">INSERT INTO Item VALUES (101, 1, 'Rice', 50, 60);<br>INSERT INTO Item VALUES (102, 2, 'Wheat', 40, 55);<br>INSERT INTO Item VALUES (103, 1, 'Sugar', 30, 45);<br>INSERT INTO Item VALUES (104, 3, 'Oil', 20, 120);<br>INSERT INTO Item VALUES (105, 4, 'Salt', 25, 20);<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>B) PL\/SQL Block<\/strong><\/h1>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Accept distributor number and display distributor and item details<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">SET SERVEROUTPUT ON;DECLARE<br>    v_dno Distributor.Dno%TYPE := &amp;Enter_Distributor_No;<br>    <br>    -- Distributor details<br>    v_name Distributor.d_name%TYPE;<br>    v_phno Distributor.phno%TYPE;BEGIN<br>    -- Fetch distributor details<br>    SELECT d_name, phno<br>    INTO v_name, v_phno<br>    FROM Distributor<br>    WHERE Dno = v_dno;    DBMS_OUTPUT.PUT_LINE('Distributor Details:');<br>    DBMS_OUTPUT.PUT_LINE('Dno: ' || v_dno);<br>    DBMS_OUTPUT.PUT_LINE('Name: ' || v_name);<br>    DBMS_OUTPUT.PUT_LINE('Phone: ' || v_phno);    DBMS_OUTPUT.PUT_LINE(' ');<br>    DBMS_OUTPUT.PUT_LINE('Items Supplied:');    -- Loop through items<br>    FOR rec IN (<br>        SELECT Item_no, item_name, qty, rate<br>        FROM Item<br>        WHERE Dno = v_dno<br>    )<br>    LOOP<br>        DBMS_OUTPUT.PUT_LINE(<br>            'Item No: ' || rec.Item_no ||<br>            ', Name: ' || rec.item_name ||<br>            ', Qty: ' || rec.qty ||<br>            ', Rate: ' || rec.rate<br>        );<br>    END LOOP;EXCEPTION<br>    WHEN NO_DATA_FOUND THEN<br>        DBMS_OUTPUT.PUT_LINE('No distributor found with given number.');<br>END;<br>\/<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A). Create SQL table with primary key and foreign key with insert 5 records. Distributor : ( Dno,d_name,phno) Item : ( Item_no,Dno,item_name,qty,rate ) B). Pl\/sql block that accept distributor no and display its details with item details be distributes. A) Create tables with PK, FK and insert records Create Distributor table CREATE TABLE Distributor ( [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":101,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,42],"tags":[25,26,43],"class_list":["post-141","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bca","category-concept-of-rdbms","tag-bca","tag-bca-paper-solution","tag-concept-of-rdbms"],"_links":{"self":[{"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/posts\/141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/comments?post=141"}],"version-history":[{"count":2,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/posts\/141\/revisions"}],"predecessor-version":[{"id":144,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/posts\/141\/revisions\/144"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/media\/101"}],"wp:attachment":[{"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/media?parent=141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/categories?post=141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/tags?post=141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}