Hi,
The following code is supposed to stop a booking being made if falls between another bookings start and end date.
Unfortunately I get the following error message
PLS-00410: duplicate fields in RECORD,TABLE or argument list are not permitted
Any help would be greatly appreciated.
Thanks in advance -
-
CREATE OR REPLACE PROCEDURE p_check_room_alloc_dates (
-
p_start_date LEASE.START_DATE%TYPE,
-
p_end_date LEASE.END_DATE%TYPE,
-
p_room_id LEASE.ROOM_ID%TYPE,
-
p_lease_id LEASE.LEASE_ID%TYPE,
-
p_error OUT VARCHAR2
-
)
-
-
IS
-
p_error VARCHAR2 (200) := NULL;
-
v_dummy NUMBER;
-
-
-
BEGIN
-
-
IF p_start_date > p_end_date
-
THEN
-
p_error := 'End date cannot be earlier than start date';
-
END IF;
-
-
-
SELECT COUNT (*)
-
INTO v_dummy
-
FROM LEASE
-
-
WHERE ( ( p_start_date >= LEASE.START_DATE
-
AND p_start_date <
-
NVL (LEASE.END_DATE, SYSDATE)
-
)
-
-
OR ( p_start_date <= LEASE.START_DATE
-
AND p_end_date > LEASE.START_DATE
-
)
-
)
-
AND LEASE.ROOM_ID = p_room_id
-
AND LEASE.LEASE_ID != p_lease_id;
-
-
IF v_dummy > 0
-
THEN
-
p_error := 'An Overlapping Room Booking Exists for these dates';
-
END IF;
-
-
EXCEPTION
-
WHEN OTHERS
-
THEN
-
p_error :=
-
'System Error '
-
|| SUBSTR (TO_CHAR (SQLCODE) || ' ' || SQLERRM, 1, 100);
-
-
END;
-
8 19445
Your error doesnt show up in your procedure. Could you please post if you are using any other record or table types in any of your code?
Sorry but we are unsure as to what you mean.
If you are meaning the p_error then we have used it several times.
This procedure is only going to be used on one table.
Thank you very much for your patience with a novice.
Sorry but we are unsure as to what you mean.
If you are meaning the p_error then we have used it several times.
This procedure is only going to be used on one table.
Thank you very much for your patience with novice.
Is your procedure getting compiled properly?
No. It gives me the response Warning: Procedure created with compilation errors.
So I used the following script to check the errors. show errors procedure p_check_room_alloc_dates
That's how I got the unhelpful responses from PL/SQL
No. It gives me the response Warning: Procedure created with compilation errors.
So I used the following script to check the errors. show errors procedure p_check_room_alloc_dates
That's how I got the unhelpful responses from PL/SQL
After messing with the code some more and taking out the line p_error varchar
the compliation errors go away.
But the script still doesn't perform the correct action.
hope this helps
Here is the problem: -
CREATE OR REPLACE PROCEDURE p_check_room_alloc_dates (
-
p_start_date LEASE.START_DATE%TYPE,
-
p_end_date LEASE.END_DATE%TYPE,
-
p_room_id LEASE.ROOM_ID%TYPE,
-
p_lease_id LEASE.LEASE_ID%TYPE,
-
p_error OUT VARCHAR2
-
)
-
-
IS
-
--p_error VARCHAR2 (200) := NULL; -- This variable was same as parameter variable causing the problem. This variable is not required.
-
v_dummy NUMBER;
-
-
-
BEGIN
-
-
IF p_start_date > p_end_date
-
THEN
-
p_error := 'End date cannot be earlier than start date';
-
END IF;
-
-
-
SELECT COUNT (*)
-
INTO v_dummy
-
FROM LEASE
-
-
WHERE ( ( p_start_date >= LEASE.START_DATE
-
AND p_start_date <
-
NVL (LEASE.END_DATE, SYSDATE)
-
)
-
-
OR ( p_start_date <= LEASE.START_DATE
-
AND p_end_date > LEASE.START_DATE
-
)
-
)
-
AND LEASE.ROOM_ID = p_room_id
-
AND LEASE.LEASE_ID != p_lease_id;
-
-
IF v_dummy > 0
-
THEN
-
p_error := 'An Overlapping Room Booking Exists for these dates';
-
END IF;
-
-
EXCEPTION
-
WHEN OTHERS
-
THEN
-
p_error :=
-
'System Error '
-
|| SUBSTR (TO_CHAR (SQLCODE) || ' ' || SQLERRM, 1, 100);
-
-
END;
-
Thanks
Now to execute the code we used the following statment
VARIABLE g_error VARCHAR2(200);
EXECUTE p_check_room_alloc_dates (26, 1, '12-MAR-2008', '24-MAR-2008', :g_error);
Print g_error;
As we know that the following booking is already in use it does give the error and does not insert the record, but if we enter data that should not fail the g_error comes back blank but no data is inserted.
I dont find any insert statement in your procedure?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Mourad |
last post by:
Hi all,
This is an example of a nested block, however it seems Oracle doesn't
like the syntax. see the error below:
declare
begin
declare...
|
by: Troy |
last post by:
I was experiencing odd behaviour from SQL Server within Vis Studio this
morning and had to uninstall SQL. Trouble is I can't seem to get it set up...
|
by: Kingkel |
last post by:
hi every1 :lol: ,
i am new to .net and c# but i am making a good progress. i am working
on database connectivity but i cant connect to my sql...
|
by: josephrthomas |
last post by:
hi..
i am using ASP.NET with VB.NET to connect to a MS Access
database...
can someone pls tell me how do i make the sql statement to
insert a new...
|
by: Danieltbt05 |
last post by:
Hi, I've created database in sql server 2000 but how to i link it to
webpage for user to use as front end application ? Pls advise. Thanks
Rgds...
|
by: varathasiva |
last post by:
Dear All,
Hw to use the replication concept in postgres sql.Pls help for me.
With Regards
Siva
|
by: Imran |
last post by:
JOB ID: SB 0501
Please refer the to Job ID in all your communication both in subject
line of your email and in the body text.
Hi Friends, Hope...
|
by: rameshcse2005 |
last post by:
Hai,
i am trying to connect online SQL serve 2005 database using my local m/c Enterprise manager for DTS purpose ( i am using SQL server 8.0 )...
|
by: vbsoft |
last post by:
Hello My Name is Mike
Am from Nigeria a student of computer Science,
Pls i want your You to help in
Using VISUAL BASIC 6.0 AND MS SQL SERVER...
|
by: harvey1 |
last post by:
I'm having problems running an Oracle stored procedure
that returns a cursor to from a web front end. The problem
occurs both with PHP and ASP.NET....
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
|
by: jalbright99669 |
last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...
| |