Jump to content

error code PLS00103


kahunabee
 Share

Recommended Posts

my assignment is below with the code following it. I am getting error code 00103 encountered "group" when expecting (a long list of commands followed, such as begin, case, declare, end...) Any suggestions????????

  • [*][*]. Write a PL/SQL block that determines whether a customer is rated high, med, or low based on his/her total purchase. The block needs to determine the rating and then display the results on screen. The program rates the customer high if total purchases are greater than $200, mid if greater than $100, and low if $100 or lower. You must use IF structure in your program. You must accept the customer ID (shopper ID) from the user and display a message that includes the customer’s number, firstname, lastname, and the rating. See sample output below.

anonymous block completedCustomer 23 Kenny RatmanThe total amount is 81.75 and the rating is LOW set serveroutput on;

declare

v_idshopper bb_basket.idshopper%type := &idshopper; v_rating char(5); v_totalbasket bb_basket.total%type; v_firstname bb_shopper.firstname%type; v_lastname bb_shopper.lastname%type;begin select firstname, lastname, sum(total) into v_firstname, v_lastname, v_totalbasket from bb_shopper join bb_basket using (idshopper) where v_idshopper like idshopper; group by firstname, lastname;

if v_totalbasket > 200 then v_rating := 'high'; elseif v_totalbasket > 100 then v_rating := 'mid'; else v_rating := 'low'; end if;

dbms_output.put_line ('Customer ' ||v_idshopper ||' ' ||v_firstname ||' ' ||v_lastname;dbms_output.put_line ('The total amount is '||v_totalbasket || (' and the rating is '||' v_rating);end;/

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...