oracle - Script is failing to pass XMLTYPE argument to PLSQL procedure -


i have script supposed open xml file , read contents , process it. plsql procedure test_load.bob_load has been created successfully.

test_load.bob_load looks this:

procedure bob_load(p_uuid in varchar2,       xml_in in  xmltype,       msg_status out varchar2,       xml_out out xmltype);  end  bob_load; / 

the script below calls procedure in final line , seems cause of error. assuming not recognising variable x xmltype.

declare     xml_file utl_file.file_type;     chars_read integer;     xml_clob clob;     xamount integer :=32767;     char_buffer varchar2(32767);     x xmltype; begin xml_file := utl_file.fopen('/export/hm/testpit/bob', 'test.xml', 'r', xamount);    dbms_lob.createtemporary(xml_clob, true);  loop  begin  utl_file.get_line(xml_file, char_buffer);     chars_read :=length(char_buffer);    dbms_lob.writeappend(xml_clob, chars_read, char_buffer);    dbms_lob.writeappend(xml_clob, 1, chr(10));    exception    when no_data_found    exit;    end;    end loop;   utl_file.fclose(xml_file);   x := xmltype.createxml(xml_clob);   test_load.bob_load('9718fa05-9995-4f17-jk1k-763113b8f4a4', x );  end;  / 

however when run script above ora-06550, pls:00306 error saying:

ora-06550: line 39, column 3: pls-00306: wrong number or types of arguments in call 'bob_load' ora-06550: line 39, column 3: pl/sql: statement ignored 

your procedure has 4 parameters. call 2. need call out parameters well.

much easier way read file's contents clob:

function read_clob_from_file(p_directory    varchar2                                ,p_filename varchar2) return clob        l_amt        number := dbms_lob.lobmaxsize;       l_dst_loc    clob;       l_dst_offset number := 1;       l_lang_ctx   number := dbms_lob.default_lang_ctx;       l_src_loc    bfile;       l_src_offset number := 1;       l_warning    number;    begin        l_src_loc := bfilename(p_directory, p_filename);       dbms_lob.createtemporary(l_dst_loc, true);       dbms_lob.fileopen(l_src_loc, dbms_lob.file_readonly);       dbms_lob.loadclobfromfile(l_dst_loc                                ,l_src_loc                                ,l_amt                                ,l_dst_offset                                ,l_src_offset                                ,dbms_lob.default_csid                                ,l_lang_ctx                                ,l_warning);       dbms_lob.fileclose(l_src_loc);       return l_dst_loc;    end; 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -