<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Oracle PL/SQL ORA-00947 Not Enough Values Error</title>
	<atom:link href="http://www.mydigitallife.info/2007/10/23/oracle-plsql-ora-00947-not-enough-values-error/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mydigitallife.info/2007/10/23/oracle-plsql-ora-00947-not-enough-values-error/</link>
	<description>Living Digitally and Electronically</description>
	<lastBuildDate>Tue, 01 Dec 2009 17:41:43 +0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: abhishek kumar</title>
		<link>http://www.mydigitallife.info/2007/10/23/oracle-plsql-ora-00947-not-enough-values-error/comment-page-1/#comment-613009</link>
		<dc:creator>abhishek kumar</dc:creator>
		<pubDate>Wed, 11 Nov 2009 09:51:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.mydigitallife.info/2007/10/23/oracle-plsql-ora-00947-not-enough-values-error/#comment-613009</guid>
		<description>while i was creating this function i got such an error, pl/sql: ora-00947:not enough values,

here is the function which i have created,for which i would like you to plz tell me about the error,and the process to correct it.

SQL&gt; create or replace function  EMPLOYEE_STATUS (aId IN number,aName IN varchar2,aDOB IN date)
  2  return varchar2
  3  as 
  4  RETIREMENT  varchar2(100);
  5  begin 
  6  select id,to_number(to_char(sysdate,&#039;YYYY&#039;)-to_char(DOB,&#039;YYYY&#039;)),
  7  (case when
  8  to_number(to_char(sysdate,&#039;YYYY&#039;)-to_char(DOB,&#039;YYYY&#039;))&gt;60 
  9  then
 10  &#039;retired&#039;
 11  else 
 12  &#039;employee&#039;
 13  end) as status
 14  into retirement
 15  from employ
 16  where aName=Name and 
 17  aID=ID; 
 18  return RETIREMENT;
 19  end EMPLOYEE_STATUS;
 20  /
here is the error:-

LINE/COL ERROR
-------- ------------------------------------
6/1      PL/SQL: SQL Statement ignored
14/17    PL/SQL: ORA-00947: not enough values
 
here is the table for which i have done such function:-

create table EMPLOY(Id Number,Name varchar2(30),DOB Date,Designation varchar2(15),Date_of_Joining Date);

insert into EMPLOY values(EmployId.nextval,&#039;Ram Ratan kumar&#039;,to_date

(&#039;11/11/1953&#039;,&#039;DD/MM/YYYY&#039;),&#039;Director&#039;,to_date(&#039;10/06/1980&#039;,&#039;DD/MM/YYYY&#039;));

insert into EMPLOY values(EmployId.nextval,&#039;Kiran Devi&#039;,to_date(&#039;19/05/1958&#039;,&#039;DD/MM/YYYY&#039;),&#039;Asst Director&#039;,to_date

(&#039;20/04/1982&#039;,&#039;DD/MM/YYYY&#039;));

insert into EMPLOY values(EmployId.nextval,&#039;Gunjan Kumar Sinha&#039;,to_date(&#039;12/01/1975&#039;,&#039;DD/MM/YYYY&#039;),&#039;General 

Manager&#039;,to_date(&#039;17/09/1999&#039;,&#039;DD/MM/YYYY&#039;));

insert into EMPLOY values(EmployId.nextval,&#039;Ranjan Kumar Sinha&#039;,to_date(&#039;10/10/1976&#039;,&#039;DD/MM/YYYY&#039;),&#039;HR&#039;,to_date

(&#039;04/08/2002&#039;,&#039;DD/MM/YYYY&#039;));

insert into EMPLOY values(EmployId.nextval,&#039;Ashish Kumar&#039;,to_date(&#039;24/03/1985&#039;,&#039;DD/MM/YYYY&#039;),&#039;Engineer&#039;,to_date

(&#039;27/01/2009&#039;,&#039;DD/MM/YYYY&#039;));

insert into EMPLOY values(EmployId.nextval,&#039;Abhishek kumar&#039;,to_date

(&#039;14/04/1945&#039;,&#039;DD/MM/YYYY&#039;),&#039;supervisor&#039;,to_date(&#039;28/06/1979&#039;,&#039;DD/MM/YYYY&#039;));

please solve my problem as early as possible.</description>
		<content:encoded><![CDATA[<p>while i was creating this function i got such an error, pl/sql: ora-00947:not enough values,</p>
<p>here is the function which i have created,for which i would like you to plz tell me about the error,and the process to correct it.</p>
<p>SQL&gt; create or replace function  EMPLOYEE_STATUS (aId IN number,aName IN varchar2,aDOB IN date)<br />
  2  return varchar2<br />
  3  as<br />
  4  RETIREMENT  varchar2(100);<br />
  5  begin<br />
  6  select id,to_number(to_char(sysdate,&#8217;YYYY&#8217;)-to_char(DOB,&#8217;YYYY&#8217;)),<br />
  7  (case when<br />
  8  to_number(to_char(sysdate,&#8217;YYYY&#8217;)-to_char(DOB,&#8217;YYYY&#8217;))&gt;60<br />
  9  then<br />
 10  &#8216;retired&#8217;<br />
 11  else<br />
 12  &#8216;employee&#8217;<br />
 13  end) as status<br />
 14  into retirement<br />
 15  from employ<br />
 16  where aName=Name and<br />
 17  aID=ID;<br />
 18  return RETIREMENT;<br />
 19  end EMPLOYEE_STATUS;<br />
 20  /<br />
here is the error:-</p>
<p>LINE/COL ERROR<br />
&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
6/1      PL/SQL: SQL Statement ignored<br />
14/17    PL/SQL: ORA-00947: not enough values</p>
<p>here is the table for which i have done such function:-</p>
<p>create table EMPLOY(Id Number,Name varchar2(30),DOB Date,Designation varchar2(15),Date_of_Joining Date);</p>
<p>insert into EMPLOY values(EmployId.nextval,&#8217;Ram Ratan kumar&#8217;,to_date</p>
<p>(&#8217;11/11/1953&#8242;,&#8217;DD/MM/YYYY&#8217;),&#8217;Director&#8217;,to_date(&#8217;10/06/1980&#8242;,&#8217;DD/MM/YYYY&#8217;));</p>
<p>insert into EMPLOY values(EmployId.nextval,&#8217;Kiran Devi&#8217;,to_date(&#8217;19/05/1958&#8242;,&#8217;DD/MM/YYYY&#8217;),&#8217;Asst Director&#8217;,to_date</p>
<p>(&#8217;20/04/1982&#8242;,&#8217;DD/MM/YYYY&#8217;));</p>
<p>insert into EMPLOY values(EmployId.nextval,&#8217;Gunjan Kumar Sinha&#8217;,to_date(&#8217;12/01/1975&#8242;,&#8217;DD/MM/YYYY&#8217;),&#8217;General </p>
<p>Manager&#8217;,to_date(&#8217;17/09/1999&#8242;,&#8217;DD/MM/YYYY&#8217;));</p>
<p>insert into EMPLOY values(EmployId.nextval,&#8217;Ranjan Kumar Sinha&#8217;,to_date(&#8217;10/10/1976&#8242;,&#8217;DD/MM/YYYY&#8217;),&#8217;HR&#8217;,to_date</p>
<p>(&#8217;04/08/2002&#8242;,&#8217;DD/MM/YYYY&#8217;));</p>
<p>insert into EMPLOY values(EmployId.nextval,&#8217;Ashish Kumar&#8217;,to_date(&#8217;24/03/1985&#8242;,&#8217;DD/MM/YYYY&#8217;),&#8217;Engineer&#8217;,to_date</p>
<p>(&#8217;27/01/2009&#8242;,&#8217;DD/MM/YYYY&#8217;));</p>
<p>insert into EMPLOY values(EmployId.nextval,&#8217;Abhishek kumar&#8217;,to_date</p>
<p>(&#8217;14/04/1945&#8242;,&#8217;DD/MM/YYYY&#8217;),&#8217;supervisor&#8217;,to_date(&#8217;28/06/1979&#8242;,&#8217;DD/MM/YYYY&#8217;));</p>
<p>please solve my problem as early as possible.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
