Solved

Writing a SQL Plus Stored Procedure

Posted on 2004-10-17
2
749 Views
Last Modified: 2012-05-05
I'm new to stored procedures and I'm supposed to write one which will create an invoice once a booking is made and calculate the total amount for the invoice.  The only procedure I need to pass to the procedure is the number of the booking for which I need to create the invoice.  A sequence should be used to generate the invoice number.

The attributes in the INVOICE table are: invoice_no, invoice_date, total_amount, due_date and amount_paid.

Could anybody help please?
0
Comment
Question by:soonshengy
2 Comments
 
LVL 6

Accepted Solution

by:
RaisinJ earned 250 total points
Comment Utility
So to clarify, you need to Insert the new Values of an Invoice, which you want to create, into your "INVOICE" table, then your going to create a report off of this?  Where will fields like "Total_Amount" and "Due_Date" and "Amount_Paid" be derived from?  Are these values which will be passed in from other sources in the DB, or from an application?

Are you aware of Oracle's Sequences, I take it from your statement above you are.  You can use this to create your Invoice Number.  Invoice_Date would just be SYSDATE, the last three fields would need to be passed in or gotten from other sources in your DB.
0
 
LVL 9

Expert Comment

by:pratikroy
Comment Utility
What is the structure of your "Booking" table ? It sounds like, you will create a record in Booking table, and you should be able to generate (insert) an invoice for the booking.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now