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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Yew12
    New Member
    • Mar 2008
    • 23

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

    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

    [code=oracle]

    CREATE OR REPLACE PROCEDURE p_check_room_al loc_dates (
    p_start_date LEASE.START_DAT E%TYPE,
    p_end_date LEASE.END_DATE% TYPE,
    p_room_id LEASE.ROOM_ID%T YPE,
    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_DAT E
    AND p_start_date <
    NVL (LEASE.END_DATE , SYSDATE)
    )

    OR ( p_start_date <= LEASE.START_DAT E
    AND p_end_date > LEASE.START_DAT E
    )
    )
    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;
    [/code]
    Last edited by amitpatel66; Apr 1 '08, 01:20 PM. Reason: code tags
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    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?

    Comment

    • Yew12
      New Member
      • Mar 2008
      • 23

      #3
      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.
      Last edited by Yew12; Apr 1 '08, 02:53 PM. Reason: Sp

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        Originally posted by Yew12
        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?

        Comment

        • Yew12
          New Member
          • Mar 2008
          • 23

          #5
          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_al loc_dates

          That's how I got the unhelpful responses from PL/SQL

          Comment

          • Yew12
            New Member
            • Mar 2008
            • 23

            #6
            Originally posted by Yew12
            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_al loc_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

            Comment

            • amitpatel66
              Recognized Expert Top Contributor
              • Mar 2007
              • 2358

              #7
              Here is the problem:

              [code=oracle]
              CREATE OR REPLACE PROCEDURE p_check_room_al loc_dates (
              p_start_date LEASE.START_DAT E%TYPE,
              p_end_date LEASE.END_DATE% TYPE,
              p_room_id LEASE.ROOM_ID%T YPE,
              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_DAT E
              AND p_start_date <
              NVL (LEASE.END_DATE , SYSDATE)
              )

              OR ( p_start_date <= LEASE.START_DAT E
              AND p_end_date > LEASE.START_DAT E
              )
              )
              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;
              [/code]

              Comment

              • Yew12
                New Member
                • Mar 2008
                • 23

                #8
                Thanks

                Now to execute the code we used the following statment

                VARIABLE g_error VARCHAR2(200);

                EXECUTE p_check_room_al loc_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.

                Comment

                • amitpatel66
                  Recognized Expert Top Contributor
                  • Mar 2007
                  • 2358

                  #9
                  I dont find any insert statement in your procedure?

                  Comment

                  Working...