Question

Create a procedure named DisplayInfo which takes customer name as a parameter and displays information of...

  1. Create a procedure named DisplayInfo which takes customer name as a parameter and displays information of that customer. (database – sql_store)

Homework Answers

Answer #1

Answer)

The proceduredure was created in Oracle Database Software.

Code

SQL Code: Before executiing the procedure the below table was created and following rows are inserted.

create table customer(cid int,cn varchar(20),city varchar(20));
insert into customer values(1001,'Jones','Tokyo');
insert into customer values(1002,'Martin','London');
insert into customer values(1003,'Ruby','texas');
insert into customer values(1004,'Ruby','Sydney');

Procedure Code

create or replace procedure proc1(n varchar) as
   ----Cursor is a variable which holds all the rows in memory
   cursor c1 is select * from customer where cn=n;
   ----The table has three fields, so three variables are declared
   ----%type indicates same datatype in the table
   id customer.cid%type;
   na customer.cn%type;
   cy customer.city%type;
   ------Procedure started
   begin
       ------cursor opened
       open c1;
      
       ----The data is displayed
       loop
           -----The value of the cursor is fetched in id,na and cy variable
           fetch c1 into id,na,cy;
           exit when c1%notfound;
           dbms_output.put_line(id||' '||na||' '||cy);
          
       end loop;
-----Procedure ended
end;

Screenshot

Before writing the code type

set serveroutput on

Know the answer?
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
Similar Questions
Create a program named admission that takes as Input the student name, GPA and the admission...
Create a program named admission that takes as Input the student name, GPA and the admission Test Score, the application should display if the student got accepted or rejected. The program should use a function named AcceptOrReject( gpa, testScore) to control the program. Acceptance is based on the following criteria: The student can get accepted in the following two cases : 1- if the GPA is less than 3.0, the test score has to be more than 80 to get...
The following question is based on this table named Customer Column Name     Type              CustId          Integer P
The following question is based on this table named Customer Column Name     Type              CustId          Integer Primary Key, CustName        Varchar2(40), Balance         Number Gender          Varchar2(1) Write the Stored Function named GetCustDetails.       The function: Has one parameter named pCustName. Must return a text value Must search for a customer row that has a CustName value equal to pCustName If a match is found return the customer's name and balance in the following format: Customer Name: Fred   Gender M   Balance 20000 If a...
Linux Write a script that takes a name as a parameter, then checks if the name...
Linux Write a script that takes a name as a parameter, then checks if the name is a file that exists in your homedirectory. Make sure to display the result.
Write Java code that attempts to call a method named bootUp() which takes a String parameter...
Write Java code that attempts to call a method named bootUp() which takes a String parameter and returns an integer value. The String parameter should be read from a file named "bootConfig.txt" and is the only value in the file. If a BootUpException is thrown, print the Exception object's message. If a DriverException occurs, call the reboot() method and rethrow the original DriverException object. If any other type of Exception is thrown, print a generic error message to the console....
Write a function named "replacement" that takes a string as a parameter and returns an identical...
Write a function named "replacement" that takes a string as a parameter and returns an identical string except with every instance of the character "i" replaced with the character "n python
Create a class that holds name and address information. Store all the information in character strings...
Create a class that holds name and address information. Store all the information in character strings that are private members of the class. Include a public function that stores the name and address. Also include a public function that displays the name and address. (Call these functions store() and display().)
Recommend/ Explain a program that takes the information of 40 students in following order Name: Father...
Recommend/ Explain a program that takes the information of 40 students in following order Name: Father Name: Enrollment number: Date of birth: After taking the information of the students, it then displays the entered information. use C++
Do 1: In Oracle Apex, create a table named “employees” give the table the following columns:...
Do 1: In Oracle Apex, create a table named “employees” give the table the following columns: Column name data type employeeID Number employeeName Varchar2(50) salary Number datehired Date Create the database script that builds the above table
A. Create a PowerShell script named “restore.ps1” within the “Requirements2” folder. For the first line, create...
A. Create a PowerShell script named “restore.ps1” within the “Requirements2” folder. For the first line, create a comment and include your first and last name along with your student ID. Note: The remainder of this task shall be completed within the same script file, “restore.ps1.” B. Write a single script within the “restore.ps1” file that performs all of the following functions without user interaction: 1. Create an Active Directory organizational unit (OU) named “finance.” 2. Import the financePersonnel.csv file (found...
Develop and write a procedure make-^ which inputs a single parameter n and which returns a...
Develop and write a procedure make-^ which inputs a single parameter n and which returns a procedure raiseToNthPower. The procedure raiseToNthPower must itself input a single parameter b, and must return b^n. You may assume that n is an integer. please, use scheme language