on ‎2020 Sep 28 11:54 AM
Hi Friends,
I came across CREATE LOCAL TEMPORARY TABLE and found that we can do delete and update operations on it whereas we cannot do any modification to the table created by CREATE LOCAL TEMPORARY COLUMN TABLE.
which one is better for usage in the SQL stored procedure and why? What if I always use CREATE LOCAL TEMPORARY TABLE? Is there any disadvantage?
Thanks,
Gaurav
Request clarification before answering.
Hi Gaurav. Seems there is an issue with the 2.0 SPS3 documentation because it says that the COLUMN table should be created by default, but I checked and indeed it is ROW table created in case of LOCAL TEMPORARY...
CREATE LOCAL TEMPORARY COLUMN TABLE "#TEST_TABLE1" (ID INTEGER, NAME VARCHAR(10));
CREATE LOCAL TEMPORARY TABLE "#TEST_TABLE2" (ID INTEGER, NAME VARCHAR(10));
CREATE LOCAL TEMPORARY ROW TABLE "#TEST_TABLE3" (ID INTEGER, NAME VARCHAR(10));
SELECT TABLE_NAME, "IS_COLUMN_TABLE" FROM M_TEMPORARY_TABLES
WHERE TABLE_NAME LIKE '%TEST%'
ORDER BY 1;
returns
TABLE_NAME |IS_COLUMN_TABLE|
------------|---------------|
#TEST_TABLE1|TRUE |
#TEST_TABLE2|FALSE |
#TEST_TABLE3|FALSE |
And per https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.03/en-US/20d58a5f75191014b2fe92141b... indeed row temporary table allows you to do Delete/Update/Upsert, that is not possible on column temporary table.
The description was fixed in the documentation for SP 04: "If neither ROW nor COLUMN is specified, the default ROW for temporary tables (local and global), and COLUMN for non temporary tables." https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.04/en-US/20d58a5f75191014b2fe92141b...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.