Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2006
    Posts
    18

    Unanswered: update statement

    Hi guys,

    I am tying to convert this to oracle please help me and tblDaysList is temporary table.

    Create Global temporary table tblDaysList_temp(Dates DATE, IsHoliday number(5)) on commit preserve rows

    UPDATE tblDaysList_temp SET IsHoliday = 1
    FROM tblDaysList dl INNER JOIN GaTable058 sr ON
    (dl.Dates BETWEEN sr.Column005 AND sr.Column006) AND Column009='N' AND Column001=@inSubOrgId

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    I can't see any correlation in your query between the table being updated and the tables in the FROM clause. Something wrong?

    Generally, in Oracle you do updates of this type something like this:
    Code:
    UPDATE t1
    SET    t1.flag = 1
    WHERE  EXISTS
    ( SELECT NULL
      FROM    t2
      WHERE   <conditions involving t1 and t2>
    )
    For example:
    Code:
    UPDATE emp
    SET    job = 'MANAGER'
    WHERE  EXISTS
    ( SELECT NULL
      FROM   dept
      WHERE  dept.mgr = emp.empno
    );
    If you need to access data from the other table(s) in the SET clause then you do it like this:
    Code:
    UPDATE emp
    SET    sal = (SELECT dept.manager_standard_sal
                  FROM   dept
                  WHERE  dept.mgr = emp.empno
                  )
    WHERE  EXISTS
    ( SELECT NULL
      FROM   dept
      WHERE  dept.mgr = emp.empno
    );
    You still need the final WHERE clause, otherwise you would set the sal column to NULL for all employees who are not department managers.

  3. #3
    Join Date
    Aug 2006
    Posts
    18

    rename a database

    Hi all,

    How to rename a existing database name in sql server.




    Thanhs&Regards,
    Raavi

Posting Permissions

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