{"id":1991,"date":"2025-05-26T01:03:32","date_gmt":"2025-05-26T05:03:32","guid":{"rendered":"https:\/\/molecularsciences.org\/content\/?p=1991"},"modified":"2025-05-22T01:12:20","modified_gmt":"2025-05-22T05:12:20","slug":"solving-pls-00410-duplicate-fields-in-record-table-or-argument-list-are-not-allowed","status":"publish","type":"post","link":"https:\/\/molecularsciences.org\/content\/solving-pls-00410-duplicate-fields-in-record-table-or-argument-list-are-not-allowed\/","title":{"rendered":"Solving PLS-00410: Duplicate Fields in RECORD, TABLE, or Argument List Are Not Allowed"},"content":{"rendered":"\n<p>The PL\/SQL error <strong>PLS-00410<\/strong> is encountered when the compiler finds <strong>duplicate identifiers<\/strong> in a <code>RECORD<\/code>, <code>TABLE<\/code>, or <strong>subprogram argument list<\/strong>. Since PL\/SQL does not allow two fields or parameters to share the same name within the same scope or structure, this error flags such issues.<\/p>\n\n\n\n<p>This article will explain the causes of this error, demonstrate examples that produce it, and show how to fix the problem effectively.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Error Message Explained<\/strong><\/h2>\n\n\n\n<p><strong>PLS-00410:<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Duplicate fields in RECORD, TABLE, or argument list are not allowed<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">What it means:<\/h3>\n\n\n\n<p>This error occurs when <strong>two or more identifiers<\/strong> (field names or parameters) have the <strong>same name<\/strong> in a <code>RECORD<\/code>, <code>TABLE<\/code>, or subprogram definition.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Common Scenarios That Trigger PLS-00410<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Duplicate Fields in RECORD<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Example (Incorrect):<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>DECLARE<br>   TYPE employee_rec IS RECORD (<br>      emp_id NUMBER,<br>      emp_name VARCHAR2(100),<br>      emp_id NUMBER  -- \u274c Duplicate field name<br>   );<br>BEGIN<br>   NULL;<br>END;<br>\/<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Error:<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>PLS-00410: duplicate fields in RECORD, TABLE or argument list are not allowed<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Fix:<\/h3>\n\n\n\n<p>Change one of the field names to be unique.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>DECLARE<br>   TYPE employee_rec IS RECORD (<br>      emp_id NUMBER,<br>      emp_name VARCHAR2(100),<br>      emp_dept_id NUMBER  -- \u2705 Unique field name<br>   );<br>BEGIN<br>   NULL;<br>END;<br>\/<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Duplicate Parameters in a Procedure or Function<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Example (Incorrect):<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>CREATE OR REPLACE PROCEDURE update_salary (<br>   emp_id NUMBER,<br>   emp_id NUMBER  -- \u274c Duplicate parameter<br>)<br>IS<br>BEGIN<br>   NULL;<br>END;<br>\/<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Error:<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>PLS-00410: duplicate fields in RECORD, TABLE or argument list are not allowed<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Fix:<\/h3>\n\n\n\n<p>Rename one of the parameters:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>CREATE OR REPLACE PROCEDURE update_salary (<br>   p_emp_id NUMBER,<br>   p_new_salary NUMBER<br>)<br>IS<br>BEGIN<br>   DBMS_OUTPUT.PUT_LINE('Updating employee ' || p_emp_id || ' salary to ' || p_new_salary);<br>END;<br>\/<br><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Duplicate Fields in a TABLE Type<\/h3>\n\n\n\n<p>Just like <code>RECORD<\/code>, if you define a PL\/SQL TABLE type or <code>VARRAY<\/code> with duplicate fields, the error will be raised.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>However, note that <code>TABLE<\/code> and <code>VARRAY<\/code> structures do not allow multiple fields. The confusion often arises when people try to define composite types improperly.<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Special Note: Shadowing Doesn\u2019t Apply<\/strong><\/h2>\n\n\n\n<p>PL\/SQL does not allow field shadowing inside composite types. Even if you&#8217;re used to shadowing variable names in nested blocks, that doesn&#8217;t apply to parameter lists or RECORD definitions. Every field must be uniquely named.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices to Avoid PLS-00410<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use <strong>prefixes<\/strong> like <code>p_<\/code> for parameters, <code>v_<\/code> for variables, <code>r_<\/code> for records to avoid naming collisions.<\/li>\n\n\n\n<li>Avoid <strong>copy-pasting<\/strong> without checking for duplicate names in parameter lists or record structures.<\/li>\n\n\n\n<li>Use <strong>meaningful field names<\/strong> to distinguish attributes (e.g., <code>emp_id<\/code>, <code>dept_id<\/code>, <code>mgr_id<\/code>).<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Example: Correct Use in RECORD and Procedure<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>DECLARE<br>   TYPE employee_rec IS RECORD (<br>      emp_id     NUMBER,<br>      emp_name   VARCHAR2(100),<br>      dept_id    NUMBER<br>   );<br><br>   r_emp employee_rec;<br><br>   PROCEDURE print_employee(p_emp_id NUMBER, p_emp_name VARCHAR2) IS<br>   BEGIN<br>      DBMS_OUTPUT.PUT_LINE('ID: ' || p_emp_id || ', Name: ' || p_emp_name);<br>   END;<br><br>BEGIN<br>   r_emp.emp_id := 101;<br>   r_emp.emp_name := 'Alice';<br>   r_emp.dept_id := 10;<br><br>   print_employee(r_emp.emp_id, r_emp.emp_name);<br>END;<br>\/<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Summary Table<\/h2>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><thead><tr><th><strong>Mistake<\/strong><\/th><th><strong>Error<\/strong><\/th><th><strong>Fix<\/strong><\/th><\/tr><\/thead><tbody><tr><td>Two fields with same name in RECORD<\/td><td>PLS-00410<\/td><td>Rename one field<\/td><\/tr><tr><td>Two procedure parameters with same name<\/td><td>PLS-00410<\/td><td>Use distinct parameter names<\/td><\/tr><tr><td>Misuse of TABLE or VARRAY syntax<\/td><td>PLS-00410<\/td><td>Use scalar values or RECORD properly<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The <strong>PLS-00410<\/strong> error is a clear indicator of poor naming or a copy-paste mistake in field or parameter lists. It\u2019s simple to fix by <strong>renaming the duplicate identifiers<\/strong> to make each one <strong>distinct and meaningful<\/strong>. Keeping your naming conventions consistent and readable helps avoid such conflicts and improves maintainability.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The PL\/SQL error PLS-00410 is encountered when the compiler finds duplicate identifiers in a RECORD, TABLE, or subprogram argument list. Since PL\/SQL does not allow two fields or parameters to share the same name within the same scope or structure, this error flags such issues. This article will explain the causes of this error, demonstrate [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[515],"tags":[529],"class_list":["post-1991","post","type-post","status-publish","format-standard","hentry","category-oracle","tag-pl-sql"],"_links":{"self":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/1991","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/comments?post=1991"}],"version-history":[{"count":2,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/1991\/revisions"}],"predecessor-version":[{"id":1996,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/1991\/revisions\/1996"}],"wp:attachment":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media?parent=1991"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/categories?post=1991"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/tags?post=1991"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}