Ok, efter uppmaning av korvgubbe bör det finnas mycket kunskap i sql här. Här kommer frågan jag postade i ett engelskt forum. Orkar inte skriva om på svenska men det ska väl inte var anågra problem...
Hi!
I have a big problem making a procedure and thought that maybe someone could help me.
1. I am working in Oracle. Is there a way to se the compilation errors? I'm only getting this message and it doesn't tell me much, only that there are some problems: Warning: Procedure created with compilation errors.
2. I have theese tables:
sale(debit, item, quantity)
debit(key, sdate, employee, account)
3. Now I have to create a procedure that creates a sale. The procedure takes a costomer account, an item number, a quantity of the item sold, the employee resposable of the transaction and the transaction number as arguments.
A transaction can be related to several sales. A new transaction should be created when the first sale of this transaction is created.
4. I have been strugeling with this code for days now and I'm getting quite desperate:
Code:
create OR replace procedure sale_add (aid IN number, item_number IN number, quantity IN number, empid IN number, transaction_number IN number)
AS BEGIN
IF (some statement that checks if a transaction (select key from debit) exists)
INSERT INTO sale (debit, item, quantity) VALUES (transaction_number, item_number, quantity);
ELSE
INSERT INTO debit (key, sysdate, employee, account, null) VALUES (transaction_number, empid, aid);
NSERT INTO sale (debit, item, quantity) VALUES (transaction_number, item_number, quantity);
END IF;
end
Again, I only get this message: Warning: Procedure created with compilation errors.
What can I do to find out what the compilation errors are?
Does somebody see the errors in the code?
Hi!
I have a big problem making a procedure and thought that maybe someone could help me.
1. I am working in Oracle. Is there a way to se the compilation errors? I'm only getting this message and it doesn't tell me much, only that there are some problems: Warning: Procedure created with compilation errors.
2. I have theese tables:
sale(debit, item, quantity)
debit(key, sdate, employee, account)
3. Now I have to create a procedure that creates a sale. The procedure takes a costomer account, an item number, a quantity of the item sold, the employee resposable of the transaction and the transaction number as arguments.
A transaction can be related to several sales. A new transaction should be created when the first sale of this transaction is created.
4. I have been strugeling with this code for days now and I'm getting quite desperate:
Code:
create OR replace procedure sale_add (aid IN number, item_number IN number, quantity IN number, empid IN number, transaction_number IN number)
AS BEGIN
IF (some statement that checks if a transaction (select key from debit) exists)
INSERT INTO sale (debit, item, quantity) VALUES (transaction_number, item_number, quantity);
ELSE
INSERT INTO debit (key, sysdate, employee, account, null) VALUES (transaction_number, empid, aid);
NSERT INTO sale (debit, item, quantity) VALUES (transaction_number, item_number, quantity);
END IF;
end
Again, I only get this message: Warning: Procedure created with compilation errors.
What can I do to find out what the compilation errors are?
Does somebody see the errors in the code?