DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: to update to tables

  1. #1
    Join Date
    Mar 2001
    Location
    Reading, U.K
    Posts
    598

    Question

    hi

    I WANNA UPDATE THE SALARY OF ALL THE EMPLOYEES WHO ARE COMMON IN BOTH THE TABLES.

    MY 1 TABLE IS EMP & THE 2 TABLE IS DEPT

    THE COMMON FILEDS ARE DEPTNO

    I WANT TO UPDATE THE SALARY OF THOSE EMPLOYEES PRESENT IN BOTH THE TABLES.

    (EG) SAY DEPTNO = 10


    JEGAN

    Cheers!
    OraKid.

  2. #2
    Join Date
    Feb 2001
    Posts
    103
    hi,
    i hope you have a realation betn two tables.
    update emp set sal=123 were emp.deptno=dept.deptno .

    When the going gets tough, the tough gets going

  3. #3
    Join Date
    Mar 2001
    Location
    Reading, U.K
    Posts
    598

    Unhappy

    hi

    this code is not working



    this the error iam getting:

    update empbak set sal=123 where empbak.deptno = deptbak.deptno
    *
    ERROR at line 1:
    ORA-00904: invalid column name

    write back
    Cheers!
    OraKid.

  4. #4
    Join Date
    Aug 2000
    Posts
    462
    update emp set sal=sal*2 where deptno in (select deptno from dept);

    The reason you get that error is that Oracle has no idea what deptbak.deptno is, since it isn't (and can't be) listed as the table to update.

    [Edited by kmesser on 04-28-2001 at 10:01 AM]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width