472,352 Members | 1,543 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,352 software developers and data experts.

PL/SQL:PLS-00410 duplicate fields in RECORDTABLE or argument list are not permitted

23
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

Expand|Select|Wrap|Line Numbers
  1.  
  2. CREATE OR REPLACE PROCEDURE p_check_room_alloc_dates (
  3.       p_start_date         LEASE.START_DATE%TYPE,       
  4.       p_end_date           LEASE.END_DATE%TYPE,       
  5.       p_room_id            LEASE.ROOM_ID%TYPE,         
  6.       p_lease_id           LEASE.LEASE_ID%TYPE,           
  7.       p_error        OUT   VARCHAR2                   
  8.    )
  9.  
  10.    IS
  11.       p_error        VARCHAR2 (200)                  := NULL;
  12.       v_dummy        NUMBER;
  13.  
  14.  
  15.     BEGIN
  16.  
  17.       IF p_start_date > p_end_date
  18.       THEN
  19.          p_error := 'End date cannot be earlier than start date';
  20.       END IF;
  21.  
  22.  
  23.       SELECT COUNT (*)
  24.         INTO v_dummy
  25.         FROM LEASE
  26.  
  27.        WHERE (   (    p_start_date >= LEASE.START_DATE
  28.                   AND p_start_date <
  29.                                   NVL (LEASE.END_DATE, SYSDATE)
  30.                  )
  31.  
  32.               OR (    p_start_date <= LEASE.START_DATE
  33.                   AND p_end_date > LEASE.START_DATE
  34.                  )
  35.              )
  36.          AND LEASE.ROOM_ID = p_room_id
  37.          AND LEASE.LEASE_ID != p_lease_id;                  
  38.  
  39.       IF v_dummy > 0
  40.       THEN
  41.          p_error := 'An Overlapping Room Booking Exists for these dates';
  42.       END IF;
  43.  
  44.      EXCEPTION
  45.       WHEN OTHERS
  46.       THEN
  47.          p_error :=
  48.                'System Error '
  49.             || SUBSTR (TO_CHAR (SQLCODE) || ' ' || SQLERRM, 1, 100);    
  50.  
  51. END;
  52.  
Apr 1 '08 #1
8 19445
amitpatel66
2,367 Expert 2GB
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?
Apr 1 '08 #2
Yew12
23
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.
Apr 1 '08 #3
amitpatel66
2,367 Expert 2GB
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?
Apr 1 '08 #4
Yew12
23
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
Apr 1 '08 #5
Yew12
23
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
Apr 1 '08 #6
amitpatel66
2,367 Expert 2GB
Here is the problem:

Expand|Select|Wrap|Line Numbers
  1. CREATE OR REPLACE PROCEDURE p_check_room_alloc_dates (
  2.       p_start_date         LEASE.START_DATE%TYPE,       
  3.       p_end_date           LEASE.END_DATE%TYPE,     
  4.       p_room_id            LEASE.ROOM_ID%TYPE,   
  5.       p_lease_id           LEASE.LEASE_ID%TYPE,        
  6.       p_error        OUT   VARCHAR2                 
  7.    )
  8.  
  9.    IS
  10.       --p_error        VARCHAR2 (200)                  := NULL; -- This variable was same as parameter variable causing the problem. This variable is not required.
  11.       v_dummy        NUMBER;
  12.  
  13.  
  14.     BEGIN
  15.  
  16.       IF p_start_date > p_end_date
  17.       THEN
  18.          p_error := 'End date cannot be earlier than start date';
  19.       END IF;
  20.  
  21.  
  22.       SELECT COUNT (*)
  23.         INTO v_dummy
  24.         FROM LEASE
  25.  
  26.        WHERE (   (    p_start_date >= LEASE.START_DATE
  27.                   AND p_start_date <
  28.                                   NVL (LEASE.END_DATE, SYSDATE)
  29.                  )
  30.  
  31.               OR (    p_start_date <= LEASE.START_DATE
  32.                   AND p_end_date > LEASE.START_DATE
  33.                  )
  34.              )
  35.          AND LEASE.ROOM_ID = p_room_id
  36.          AND LEASE.LEASE_ID != p_lease_id;                  
  37.  
  38.       IF v_dummy > 0
  39.       THEN
  40.          p_error := 'An Overlapping Room Booking Exists for these dates';
  41.       END IF;
  42.  
  43.      EXCEPTION
  44.       WHEN OTHERS
  45.       THEN
  46.          p_error :=
  47.                'System Error '
  48.             || SUBSTR (TO_CHAR (SQLCODE) || ' ' || SQLERRM, 1, 100);    
  49.  
  50. END;
  51.  
Apr 1 '08 #7
Yew12
23
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.
Apr 1 '08 #8
amitpatel66
2,367 Expert 2GB
I dont find any insert statement in your procedure?
Apr 1 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
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...
1
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...
2
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...
5
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...
7
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...
2
by: varathasiva | last post by:
Dear All, Hw to use the replication concept in postgres sql.Pls help for me. With Regards Siva
0
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...
2
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 )...
1
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...
3
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....
0
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...
0
jalbright99669
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...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
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...
0
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...
0
hi
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...
0
Oralloy
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...
0
BLUEPANDA
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...
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.