Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 PROCEDURE CREATED WITH COMPLITATION ERRRORS

Author  Topic 

ahmed1
Starting Member

1 Post

Posted - 2014-12-15 : 18:45:58
case study: 3. Automatically produce a bill.

This should presumably take a Patient or Booking number and display on screen: the Patient’s name, the room/cost of their stay and a list of the treatments they have received and prices, all summed up in a final total – with an optional discount aspect for bills over a certain amount or stays over a specific length of time. The rationale for the optional discount is up to you to decide and make a business case for its implementation.
CREATE OR REPLACE PROCEDURE myBILL(v_PAT in PATIENT.PAT_ID%TYPE)

V_NUMOFDAYS,
V_TRTMENT PRICE,
V_ROOMPRIC,
V_P_LSTNME VARCHAR2(20);

BEGIN
SELECT PATIENT.P_LSTNME
INTO V_P_LSTNME
FROM PATIENT
WHERE PAT_ID=V_PAT_ID;

DBMS_OUTPUT.PUT_LINE(V_NUMBER OF DAYS THIS IS THE INVOICE FOR ') || V_P_LSTNME);

SELECT CHECKINDATE-CHECKOUTDATE
INTO V_NUMOFDAYS
FROM CHECKING
WHERE CHECKING.CHECKINDATE = V_NUMBEROFDAYS
AND CHECKING.CHECKOUTDATE = V_NUMBEROFDAYS;

DBMS_OUTPUT.PUT_LINE('THE NUMBER OF DAYS IS ' || V_NUMOFDAYS);

SELECT TRTMENTPRICE
INTO V_TRTMNTPRICE
FROM TREATMENT
WHERE TREATMENT.TRT_ID= V_TRT_ID
AND PAT_ID= V_P_LSTNAME;

V_TREATMENTCOST := V_NUMOFDAYS * V_TREATMENTCOST;
DBMS_OUTPUT.PUT_LINE ('THE TREATMENT BILL IS ' ||V_TOTALTREATMENTCOST;


V_TOTALBILL := V_NUMOFDAYS * V_TREATMENTCOST;
DBMS_OUTPUT.PUT_LINE('THE TOTAL PAYABLE BILL IS ' ||V_TOTALBILL0);

END;
/


HELP ASSIGNMENT DUE IN TOMORROW

a hardy

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-12-15 : 18:47:56
This is not T-SQL code (Microsoft SQL Server), so we are unable to help. Plus we don't do people's homework unless effort has been shown.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -