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
Write a Racket function named listlen that takes a list as a parameter and evaluates to...
Write a Racket function named listlen that takes a list as a parameter and evaluates to the number of elements in the list. For example (listlen empty) should evaluate to 0 and (listlen '(1 2 3)) should eveluate to 3.
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
Create a Just BASIC console application that calculates and displays First And Last Name, Gross Pay,...
Create a Just BASIC console application that calculates and displays First And Last Name, Gross Pay, Taxes Withheld, and Net Pay based on specified user input. In English Using (Just Basic v2.0).
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT