Question

oracle 11g 2nd edition pl/sql Assignment 5-10: Returning a Record Create a procedure named DDPROJ_SP that...

oracle 11g 2nd edition

pl/sql

Assignment 5-10: Returning a Record Create a procedure named DDPROJ_SP that retrieves project information for a specific project based on a project ID. The procedure should have two parameters: one to accept a project ID value and another to return all data for the specified project. Use a record variable to have the procedure return all database column values for the selected project. Test the procedure with an anonymous block.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Any doubt please comment me.

Answer)

----I created a project table

create table project(pid int,pname varchar(30),psdate date,pedate date,mid int);

insert into project values (1,'Java','23-apr-2019','23-oct-2019',1001);
insert into project values (2,'C++','25-apr-2019','26-oct-2019',1001);

commit;


----Procedure create with id as IN variable, and ptab as OUT variable.
----IN variable is to send data inside the procedure and OUT variable is for
----return the value from a procedure.

----Procedure created

create or replace procedure DDPROJ_SP(id int,ptab out project%rowtype)
is
begin
----when the id matches it returns it return the whole row into
----record type variable ptab
select * into ptab from project where pid=id;
end;

set serveroutput on

----Anonymous block for testing

declare
----Declare a recordtype variable which hold the record from the procedure
prec project%rowtype;
begin
----execute the procedure
DDPROJ_SP(1,prec);
----display the values when returned
dbms_output.put_line(prec.pid||' '||prec.pname||' '||prec.mid);
end;

Screenshot

Add a comment
Know the answer?
Add Answer to:
oracle 11g 2nd edition pl/sql Assignment 5-10: Returning a Record Create a procedure named DDPROJ_SP that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Oracle PL/SQL Using Dynamic SQL to create a procedure named add_row_sp for inserting a row into...

    Oracle PL/SQL Using Dynamic SQL to create a procedure named add_row_sp for inserting a row into a table with three columns: add_rows (p_table_name VARCHAR2, p_column1 NUMBER, p_column2 VARCHAR2, p_column3 NUMBER). Testing the procedure by using the following block to add a record to the BB_TAX table: BEGIN add_row_sp ('BB_TAX', 4, 'SD', 0.02); END;

  • Oracle 11g PL/SQL Programming Sometimes Brewbean’s customers mistakenly leave an item out of a basket that’s...

    Oracle 11g PL/SQL Programming Sometimes Brewbean’s customers mistakenly leave an item out of a basket that’s already been checked out, so they create a new basket containing the missing items. However, they request that the baskets be combined so that they aren’t charged extra shipping. An application page has been developed that enables employees to change the basket ID of items in the BB_BASKETITEM table to another existing basket’s ID to combine the baskets. A block has been constructed to...

  • The procedure is a sample and needs to be modified. The software used is oracle 11g. Provide screen shot of the program running. EX.NO. 6 SQL TRIGGER AIM To develop the package for employee managemen...

    The procedure is a sample and needs to be modified. The software used is oracle 11g. Provide screen shot of the program running. EX.NO. 6 SQL TRIGGER AIM To develop the package for employee management system using SQL triggers. DATABASE SCHEMA EMP (EMPID, NAME, SALARY, COMMISSION, DEPT NO) PROCEDURE STEP 1: Start STEP 2: Initialize the trigger with specific table id STEP 3: Develop and execute SQL trigger to carry out the following action. Create a trigger on EMP table...

  • We are using, Oracle Database 11g Express Edition. use SQL and the TAL Distrutors database (see...

    We are using, Oracle Database 11g Express Edition. use SQL and the TAL Distrutors database (see figure 1-2 in chapter 1) to complete the following exercises. if directed to do so by your instructor, use the information provided with the chapter 3 exercises to print your output or save it to a document. 1. list the item number, description, and price for all items. 2. list all rows and columns for the complete ORDERS table. 3. list the names of...

  • For this set of Review Questions, we will create and use a database for the Wedgewood...

    For this set of Review Questions, we will create and use a database for the Wedgewood Pacific Corporation (WPC) that is similar to the Microsoft Access database we created and used in Chapters 1 and 2. Founded in 1957 in Seattle, Washington, WPC has grown into an internationally recognized organization. The company is located in two buildings. One building houses the Administration, Accounting, Finance, and Human Resources departments, and the second houses the Production, Marketing, and Information Systems departments. The...

  • Put all of your SQL code in a file named grades.sql and submit it below. Download...

    Put all of your SQL code in a file named grades.sql and submit it below. Download the starter code, which contains import_grades.sql and the grades.csv file. Using he import_grades, sql file, create your database and table. - 0 eded. 1 T Une Modify the LOAD DATA INFILE to correct the path to load the grades.csv file, and add/remove LOCAL he only modification you may make to the import_grades.sql or the grades.csv files. The data represents grades for assignments in a...

  • PL/SQL Auction Program 1. Create a user xyz, who is the owner of the auction. Create...

    PL/SQL Auction Program 1. Create a user xyz, who is the owner of the auction. Create the schema, and package. 2. Create users x1 and x2 who are the participants in the auction. They will need acces to the package. 3. Bid on the same item and record your observations. Verify all scenarios. Upload the files with the missing code and a detailed sample run. AUCTION OWNER.TXT SQL> conn / as sysdba Connected. SQL> drop user xyz cascade; User dropped....

  • SQL Queries – in this assignment you will be asked to create several SQL queries relating...

    SQL Queries – in this assignment you will be asked to create several SQL queries relating to the Sakila database that we installed in class. You may freely use DBeaver to create these queries, but I will expect your solution to show me the SQL code to answer or complete the tasks below. Write a query that produces the last name, first name, address, district, and phone number for every customer in the customer table. (You don’t need to include...

  • 1. Create a PL/SQL program block that determines the top students with respect to GPA. Assume...

    1. Create a PL/SQL program block that determines the top students with respect to GPA. Assume that the database has four tables. Student(SSN, SName, DOB, Major) , Grade(SSN, CNo, Grade(0,1,2,3,4)) and Course table(CNo,CName, Credit Hour), Prerequisite(CNo, PreCNo); Student and couse data ae given in the following SQL statements a. Accept a number n as user input with SQL*Plus telling top n%. b. In a loop get the SName and GPA of the top n% people with respect to GPA. c....

  • Use the SQL statements provided to create your tables. Write one SQL statement for each of...

    Use the SQL statements provided to create your tables. Write one SQL statement for each of the following problems. You can only use the conditions listed in the tasks. E.g., in task 1, you cannot manually look up pid of Information Systems undergraduate program. Here is the given code: drop table textbook_schedule cascade constraints; drop table textbook_author cascade constraints; drop table schedule cascade constraints; drop table course cascade constraints; drop table textbook cascade constraints; drop table author cascade constraints; drop...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT