i'm gonna to explain you my problem. I have to convert a t-sql script into a pl/sql script. There is my code in t-sql :
CREATE TABLE #temp_tb ( temp_row nvarchar(max))
if @@error <> 0 goto lbl_end
DECLARE @bulk_cmd varchar(1000)
set @bulk_cmd = 'BULK INSERT #temp_tb FROM ''c:\Communication\Test\MSG_IN\'+'$(nomfic)'+''' WITH
(
CODEPAGE = ''RAW'',
ROWTERMINATOR = '''+CHAR(10)+''',
DATAFILETYPE = ''WIDECHAR''
)'
exec (@bulk_cmd)
if @@error <> 0 goto lbl_end
And after a lot of oracle doc and forum, i write this :
CREATE GLOBAL TEMPORARY TABLE temp_tb ( temp_row NCHAR(MAX)) ON COMMIT DELETE ROWS;
BEGIN
EXCEPTION
WHEN OTHERS THEN GOTO lbl_end;
END;
DECLARE bulk_cmd varchar2(1000);
bulk_cmd := 'BULK INSERT temp_tb FROM ''c:\Communication\Test\MSG_IN\'+'$(nomfic)'+''' WITH
(
CODEPAGE = ''RAW'',
ROWTERMINATOR = '''+CHAR(10)+''',
DATAFILETYPE = ''WIDECHAR''
)';
BEGIN
exec (bulk_cmd);
EXCEPTION
WHEN OTHERS THEN GOTO lbl_end;
END;
But, i've an error here NCHAR(MAX)
. I've to put a large value like 100000 ? If i put this, he retunrs me an error after the EXECEPTION
Syntax error...
In other hand, if someone can say me how to adapt me bulk collect... I don't find any doc on bulk collect to integrated file like me...
I hope i'm clear, because it's really difficult for me to explain... I'm beginner in Oracle(PL/SQL)...
Thank's for help guys, again
EDIT : I launch this script by a .bat. I took parameters, that's filled '$(nomfic)' with the values in function of the parameters.