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.
...
User Profile
Collapse
Profile Sidebar
Collapse
Kburton
Last Activity: Jul 23 '07, 03:56 PM
Joined: Oct 30 '06
Location:
-
Global Temporary Table and 'AS' clause
-
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? -
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... -
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');
Leave a comment:
-
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) || ','... -
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...
No activity results to display
Show More
Leave a comment: