|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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?? ![]() |
|
#2
|
||||
|
||||
|
Move this thread to the Oracle forum, this is about MySQL
__________________
My blog about OpenSource Databases PDF tutorials about OSS databases, DBMonster ... Please contribute to Open Source Development, fill bug reports!!! Developer Shed eSupport Commented my.ini/my.cnf (PLEASE ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins |
|
#3
|
|||
|
|||
|
Quote:
How do i move this thread to the oracle forum? |
|
#4
|
|||
|
|||
|
Uh, pabloj can't you move it? Or does a MySQL mod have to do that?
__________________
BookMooch.com : Give books away. Get books you want. |
|
#5
|
||||
|
||||
|
Quote:
You can click the red triangle at the top right of your post. In the message just let the moderator know you have put it in the incorrect forum and please move it to appropriate forum for you.
__________________
MySQL - reformat varchar dates to proper date type || MySQL - room vacancies || output results with column names with mysql only Latest row per group || Deleting duplicates || Gaps in auto increment column My site: sql help articles |
|
#6
|
||||
|
||||
|
Sorry for the late answer, I can't move it, a mod of MySQL forum or the author must move it.
|
|
#7
|
||||
|
||||
|
Quote:
I think Rudy said that you had to be a moderator of that particular forum the question is in, before you could move it to another forum. Last edited by Guelphdad : March 23rd, 2005 at 07:15 AM. |
|
#9
|
|||
|
|||
|
Ok now that we've all detracted from the topic enough, can someone help this poor soul?
![]() |
|
#10
|
||||
|
||||
|
well, i'm not really all that familiar with oracle procedures (in fact, not at all), but the actual UPDATE statement itself looks plenty wonky
if i'm reading it right, all the assignments need to be flipped over so instead of setting v_salary to be equal to salary, it should be setting salary to be equal to v_salary ![]() oh, and there should probably be a WHERE clause, otherwise the same values will update every row in the table ![]() |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > update SQL not working |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|