Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 22nd, 2005, 10:43 AM
stevensys stevensys is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 12 stevensys User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 35 m 36 sec
Reputation Power: 0
Unhappy Update SQL error

hi, my update sql here not working, already try many steps but it come out error.
below is my SQL plus code

Code:
create or replace procedure updateinstructor
(v_salary number, date_hired varchar2, v_insrucid number, v_instrucname varchar2, v_commission number, v_mentorid number) is
begin
  IF v_salary <= 3500 or MONTHS_BETWEEN(SYSDATE, to_date(date_hired,'dd-mon-yyyy') ) / 12 <= 21
  THEN
    RAISE_APPLICATION_ERROR (-20501, 'Inserting Record Failure, only Mentor that work more than 21 years or salary more than 3500 can act as mentor');
  else
    update  INSTRUCTOR
	set v_salary = salary
	    ,date_hired = date_hired
	    ,v_insrucid = instructor_id
	    ,v_instrucname = instructor_name
	    ,v_commission = commission
	    ,v_mentorid = mentor_id;

end if;
end updateinstructor;
/

somehow it come out error as below.

**********************
LINE/COL ERROR
-------- -----------------------------------------------------------------
8/5 PL/SQL: SQL Statement ignored
9/6 PL/SQL: ORA-01733: virtual column not allowed here

************************

and below is my table desc.
SQL> desc instructor
Name Null? Type
----------------------------------------- -------- --------------------
INSTRUCTOR_ID NOT NULL NUMBER(3)
INSTRUCTOR_NAME VARCHAR2(15)
SALARY NUMBER(6,2)
COMMISSION NUMBER(6,2)
MENTOR_ID NUMBER(3)
DATE_HIRED DATE



please help me out??

Reply With Quote
  #2  
Old March 22nd, 2005, 12:16 PM
swampBoogie swampBoogie is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jan 2003
Location: Paris Uppland
Posts: 1,784 swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Weeks 4 Days 21 h 42 m 49 sec
Reputation Power: 37
It should be the other way round in the set clause.

Code:
	set salary = v_salary


et.c.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Update SQL error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT