please use sql to answer the following question an erd has been provide Task 1:  Creating a Logon Procedure    The home page of the Brewbean’s Web site has an option for members to log on with their IDs  and passwords. Develop a procedure named MEMBER_CK_SP that accepts the user ID and password  as inputs, checks whether they match a valid logon, and returns the member first name+lastname  and cookie  value.     The name should be returned as a single text string containing the first and last name.  The head developer wants the number of parameters minimized so that the same  parameter is used to accept the password and return the name value. (passwd Paramater as IN OUT   use passwd as INPUT  firstname||lastname  as OUTPUT)     Also, if the user doesn’t enter a valid username and password, return the value INVALID in a parameter named  p_check.     Test the procedure using a valid logon first, with the username rat55 and password kile. Then try it with an invalid logon by changing the username to rat  and kile999  password.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question
100%

please use sql to answer the following question an erd has been provide

Task 1:  Creating a Logon Procedure   

The home page of the Brewbean’s Web site has an option for members to log on with their IDs 

and passwords. Develop a procedure named MEMBER_CK_SP that accepts the user ID and password 

as inputs, checks whether they match a valid logon, and returns the member first name+lastname  and cookie 

value.  

 

The name should be returned as a single text string containing the first and last name. 

The head developer wants the number of parameters minimized so that the same 

parameter is used to accept the password and return the name value. (passwd Paramater as IN OUT   use passwd as INPUT  firstname||lastname  as OUTPUT) 

  

Also, if the user doesn’t enter a valid username and password, return the value INVALID in a parameter named 

p_check.  

 

Test the procedure using a valid logon first, with the username rat55 and password kile. Then try it with an invalid logon by changing the username to rat  and kile999  password. 

 

 

Hint:  

This procedure will have 4 parameters 

p_userid       IN 

p_passwd    IN OUT 

p_cookie     OUT 

p_check      OUT 

 

You will select and return two columns/ information from bb_shopper table in this procedure body. 

 

BEGIN 

   Hint for SELECT statement is like below 

 

Firstname ||lastname ,   cookie      INTO two local variables  (p_passwd , p_cookie) 

from bb_shoppper     

WHERE username=userid   and  password=passwd   

 

 

Assuming your SELECT statement will find record matching username and password  and returns  a records then right after SELECT statement you should have a statement like below 

  

p_check := ‘VALID USER’; 

  

Otherwise add Exception to give   ‘Invalid User’  message 

 

EXCEPTION 

  WHEN NO_DATA_FOUND THEN 

  

END program; 

 

Once you are done with developing procedure you can test like below 

  

Test Cases: 

Valid username scenario 

 

DECLARE 

  lv_pass_txt VARCHAR2(30):=’kile’; 

  lv_cook_num bb_shopper.cookie%TYPE; 

  lv_chk_txt VARCHAR2(7); 

BEGIN 

  member_ck_sp('rat55',lv_pass_txt,lv_cook_num,lv_chk_txt); 

    DBMS_OUTPUT.PUT_LINE(lv_pass_txt);     -- this will return Kenny Ratman 

    DBMS_OUTPUT.PUT_LINE(lv_cook_num);    -- this will return 0 

    DBMS_OUTPUT.PUT_LINE(lv_chk_txt);     -- this will return VALID USER 

END; 

 

Invalid username scenario  (username : rat   passwd :kile 

DECLARE 

  lv_pass_txt VARCHAR2(30):=’wrong password’; 

  lv_cook_num bb_shopper.cookie%TYPE; 

  lv_chk_txt VARCHAR2(7); 

BEGIN 

  member_ck_sp('rat',lv_pass_txt,lv_cook_num,lv_chk_txt); 

    DBMS_OUTPUT.PUT_LINE(lv_pass_txt); -- returns. wrong password (because first name and last name is not selected 

    DBMS_OUTPUT.PUT_LINE(lv_cook_num);    --NULL result will come 

    DBMS_OUTPUT.PUT_LINE(lv_chk_txt);     -- Invalid User  

END; 

 

bb_shopper
bb_department
bb_basket
bb_basketstatus
bb_product
bb_basketitem
bb_tax
bb_shipping
bb_productoption
bb_productoptiondetail
bb_productoptioncategory
FIGURE 1-7 The Brewbean's database ERD
Transcribed Image Text:bb_shopper bb_department bb_basket bb_basketstatus bb_product bb_basketitem bb_tax bb_shipping bb_productoption bb_productoptiondetail bb_productoptioncategory FIGURE 1-7 The Brewbean's database ERD
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Query Syntax
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education