User Profile

Collapse

Profile Sidebar

Collapse
Kburton
Kburton
Last Activity: Jul 23 '07, 03:56 PM
Joined: Oct 30 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Kburton
    started a topic Global Temporary Table and 'AS' clause
    in DB2

    Global Temporary Table and 'AS' clause

    Is it possible to create a temporary table and fill it with data in single declare statement?
    Example:

    Declare global temporary table session.tmp1 AS
    (select tid,fid,name from <table> where tid in (select tid,name from <table>)).

    This results in an error indicating db2 was expecting the 'definition only' token. If I add the 'definition only' token to the statement it works.

    ...
    See more | Go to post

  • Kburton
    replied to DB2 views - Read Only
    in DB2
    You can't insert, update or delete from a view that contains more than one table or the fact that it contains columns from more than one table?

    If I have a view that joins two tables but only displays columns from a single table, could I insert, delete or update via the view?

    Using my scenario from the original posting, can I create 'instead of triggers' on the view and perform insert, update, and deletes?
    See more | Go to post

    Leave a comment:


  • Kburton
    started a topic DB2 views - Read Only
    in DB2

    DB2 views - Read Only

    What criteria is used by the system to determine if a view is read only? I created a view that involves two tables. It does display columns from each of the tables. All columns in both tables can be updated. I am not using any functions on the columns, no calcuations, no group or having clauses. The tables have no constraints of any kind at this time.

    create view as select a.name, b.id,bname,b.va lue1, b.values2 from tablea a, tableb...
    See more | Go to post

  • Kburton
    replied to Dynamic insert via stored procesdure
    in DB2
    Code:
    I am no longer getting the SQL0440N error. I performed a CAST on non-charater based values. I used STRIP (CAST(variable as char()). The problem is that I am now getting issues with the data format that I am trying to insert.
    
    I am getting an SQL0104N An unexpected token ".00" was found following "'8,2007-05-05-00.00"
    
    Here is the sp call:
    
    call put_monitor_info ('T50005',Test','20','Test',8,2007-05-05-00.00.00.00000,'test');
    ...
    See more | Go to post

    Leave a comment:


  • Kburton
    started a topic Dynamic insert via stored procesdure
    in DB2

    Dynamic insert via stored procesdure

    I am trying to insert date into a table via a stored procedure. I am attempting to build the SQL statement from parameteres passed into the procedure. Here is the contents of the procedure so far:

    Begin
    Declare insert_stmt varchar(2048);
    Set insert_stmt = 'insert into db2mon.' || branch || ' (TID,ipaddress, functionname,co mments) values ('|| userid || ',' || ipaddress || ',' || fname || ','|| char(duration) || ','...
    See more | Go to post

  • Kburton
    started a topic Temporary Tables and Cursors to read them
    in DB2

    Temporary Tables and Cursors to read them

    All,

    I am trying to declare a cursor on global temporary table. I declared the global temporary table first and then the cursor but I got the following error:

    42601(-104)[IBM][CLI Driver][DB2/NT64] SQL0104N An unexpected token "<cursor declaration>" was found following "". Expected tokens may include: "<SQL statement>". LINE NUMBER=11. SQLSTATE=42601

    Here...
    See more | Go to post
No activity results to display
Show More
Working...