@:INTERNAL: Document only applicable to Relational Migration Services.
@ <Note to Author: DO NOT DELETE the following Disclaimer>
@ <Note to Moderator: DELETE the following Disclaimer before you set
@ this article to PUBLISHED>

Purpose
To inform migration specialists of the correct procedure for migrating variable usage in temporary table definitions.
Scope & Application
The audience for this document is Oracle customers, partners and migration specialists.
Migrating Variable Usage In Temporary Table Definitions
The global temporary table needs to be created as follows.

CREATE GLOBAL TEMPORARY TABLE tt_java_mytable ON COMMIT PRESERVE ROWS AS
SELECT RPAD(‘ ‘, 200, ‘ ‘),t.id, t.amount from table2 t
WHERE 1=0;

The RPAD() function is used to represent the variable datatype. In our example the variable is defined as varchar(200), and RPAD to pad out the column to be 200.


If the variable was defined as an int, then we would replace the RPAD() expression with 0.0:

CREATE GLOBAL TEMPORARY TABLE tt_java_mytable ON COMMIT PRESERVE ROWS AS
SELECT RPAD(0.0:),t.id, t.amount from table2 t
WHERE 1=0;

BeforeAfter
My_var varchar(200);

Select my_var,id,amount into #mytable
From table2

My_var varchar2(200);

Insert into tt_java_mytable
select My_var,id,amount from table2

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy