SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Write PL/SQL or T-SQL procedures to accomplish the
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Kaiokhen
Starting Member

1 Posts

Posted - 04/30/2012 :  08:37:50  Show Profile  Reply with Quote
I am stuck with this problem and its giving me error. I cant find whats wrong with the code. The error says

Warning: Procedure created with compiled error


5. Write PL/SQL or T-SQL procedures to accomplish the following tasks:
a. Obtain the name and credit limit of the customer whose number currently is stored in
I_CUSTOMER_NUM. Place these values in the variables I_CUSTOMER_NAME and
I_CREDIT_LIMIT, respectively. Output the contents of I_CUSTOMER_NAME and
I_CREDIT_LIMIT.

This is what i have

CREATE OR REPLACE PROCEDURE DISP_ORDER_NUM
(I_ORDER_NUM IN ORDERS.ORDER_NUM%TYPE) AS
I_ORDER_DATE ORDERS.ORDER_DATE%TYPE;
I_CUSTOMER_NUM CUSTOMER.CUSTOMER_NUM%TYPE;
I_CUSTOMER_NAME CUSTOMER.CUSTOMER_NAME%TYPE;

BEGIN
SELECT ORDER_DATE, CUSTOMER_NUM, CUSTOMER_NAME
INTO I_ORDER_DATE, I_CUSTOMER_NUM, I_CUSTOMER_NAME
FROM ORDERS, CUSTOMER
WHERE ORDER_NUM = I_ORDER_NUM
AND ORDERS.CUSTOMER_NUM = CUSTOMER.CUSTOMER_NUM;

DBMS_OUTPUT.PUT_LINE(I_ORDER_DATE, I_CUSTOMER_NUM, I_CUSTOMER_NAME);

END;
/


b. Obtain the order date, customer number, and name for the order whose number currently
is stored in I_ORDER_NUM. Place these values in the variables I_ORDER_DATE,
I_CUSTOMER_NUM and I_CUSTOMER_NAME, respectively. Output the contents of
I_ORDER_DATE, I_CUSTOMER_NUM, and I_CUSTOMER_NAME.

This is what i have

CREATE OR REPLACE PROCEDURE DISP_ORDER_NUM (I_ORDER_NUM IN ORDERS.ORDER_NUM%TYPE) AS
I_ORDER_DATE ORDERS.ORDER_DATE%TYPE;
I_CUSTOMER_NUM CUSTOMER.CUSTOMER_NUM%TYPE;
I_CUSTOMER_NAME CUSTOMER.CUSTOMER_NAME%TYPE;

BEGIN
SELECT ORDER_DATE, CUSTOMER_NUM, CUSTOMER_NAME
INTO I_ORDER_DATE, I_CUSTOMER_NUM, I_CUSTOMER_NAME
FROM ORDERS, CUSTOMER
WHERE ORDER_NUM = I_ORDER_NUM
AND ORDERS.CUSTOMER_NUM = CUSTOMER.CUSTOMER_NUM;

DBMS_OUTPUT.PUT_LINE(I_ORDER_DATE, I_CUSTOMER_NUM, I_CUSTOMER_NAME);

END;
/

c. Add a row to the ORDERS table.



d. Change the date of the order whose number is stored in I_ORDER_NUM to the date
currently found in I_ORDER_DATE.



e. Delete the order whose number is stored in I_ORDER_NUM.

robvolk
Most Valuable Yak

USA
15636 Posts

Posted - 04/30/2012 :  09:19:58  Show Profile  Visit robvolk's Homepage  Reply with Quote
1. SQLTeam is a Microsoft SQL Server web site. For Oracle questions try http://dbforums.com/
2. We don't answer homework, exam, or certification questions on SQLTeam.
Go to Top of Page

vinu.vijayan
Posting Yak Master

India
227 Posts

Posted - 05/01/2012 :  08:04:58  Show Profile  Reply with Quote
There is nothing more left to say.
Rob has said everything.

N 28° 33' 11.93148"
E 77° 14' 33.66384"
Go to Top of Page

robvolk
Most Valuable Yak

USA
15636 Posts

Posted - 05/01/2012 :  09:15:29  Show Profile  Visit robvolk's Homepage  Reply with Quote
quote:
Originally posted by vinu.vijayan

There is nothing more left to say.
Rob has said everything.
But don't let that stop you!
Go to Top of Page

DonAtWork
Flowing Fount of Yak Knowledge

2145 Posts

Posted - 05/01/2012 :  09:29:45  Show Profile  Reply with Quote
quote:
Originally posted by robvolk

quote:
Originally posted by vinu.vijayan

There is nothing more left to say.
Rob has said everything.
But don't let that stop you!


Won't stop my quest for a higher post count either!










How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

vinu.vijayan
Posting Yak Master

India
227 Posts

Posted - 05/02/2012 :  00:25:45  Show Profile  Reply with Quote
quote:
Originally posted by DonAtWork

quote:
Originally posted by robvolk

quote:
Originally posted by vinu.vijayan

There is nothing more left to say.
Rob has said everything.
But don't let that stop you!


Won't stop my quest for a higher post count either!












How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp



N 28° 33' 11.93148"
E 77° 14' 33.66384"
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000