Local variables and select statements  Local variables and subqueries

Chapter 14: Using Batches and Control-of-Flow Language

Local variables and update statements

You can assign variables directly in an update statement. You do not need to use a select statement to assign a value to a variable. When you declare a variable, it has the value NULL. Here is the syntax:

update [[database.]owner.] {table_name | view_name}
     set [[[database.]owner.]{table_name. | view_name.}] 
          column_name1 = 
                {expression1 | null | (select_statement)} |
          variable_name1 = {expression1 | null} 
          [, column_name2 = {expression2 | null |
                (select_statement)}]... | 
          [, variable_name2 = {expression2 | null}]...
     [from [[database.]owner.]{table_name | view_name} 
                [, [[database.]owner.] {table_name | 
                view_name}]]... 
     [where search_conditions] 




Copyright © 2005. Sybase Inc. All rights reserved. Local variables and subqueries

View this book as PDF