RESTful service cannot insert data using PL/SQL.

Hi all
Spin: stand-alone 2.01 AL on OEL 4.8 in box a. VM
Database Oracle 10.2.0.4 with Apex 4.2.0.00.27 on OEL4.8 in the VM B box.

Measure of oracle.example.hr performed without problem Restful services.

Cannot insert data using AL 2.0.1 but works on 1.1.4 AL.
who uses the following table (under scheme: scott):
 
create table json_demo ( title varchar2(20), description varchar2(1000) ); 
grant all on json_demo to apex_public_user; 
and procedure (scott diagram) below:
CREATE OR REPLACE
PROCEDURE post(
    p_url     IN VARCHAR2,
    p_message IN VARCHAR2,
    p_response OUT VARCHAR2)
IS
  l_end_loop BOOLEAN := false;
  l_http_req utl_http.req;
  l_http_resp utl_http.resp;
  l_buffer CLOB;
  l_data       VARCHAR2(20000);  
  C_USER_AGENT CONSTANT VARCHAR2(4000) := 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)';
BEGIN
  -- source: http://awads.net/wp/2005/11/30/http-post-from-inside-oracle/
  -- Ask UTL_HTTP not to raise an exception for 4xx and 5xx status codes,
  -- rather than just returning the text of the error page.
  utl_http.set_response_error_check(false);
  -- Begin the post request
  l_http_req := utl_http.begin_request (p_url, 'POST', utl_http.HTTP_VERSION_1_1);
  -- Set the HTTP request headers
  utl_http.set_header(l_http_req, 'User-Agent', C_USER_AGENT);
  utl_http.set_header(l_http_req, 'content-type', 'application/json;charset=UTF-8');
  utl_http.set_header(l_http_req, 'content-length', LENGTH(p_message));
  -- Write the data to the body of the HTTP request
  utl_http.write_text(l_http_req, p_message);
  -- Process the request and get the response.
  l_http_resp := utl_http.get_response (l_http_req);
  dbms_output.put_line ('status code: ' || l_http_resp.status_code);
  dbms_output.put_line ('reason phrase: ' || l_http_resp.reason_phrase);
  LOOP
    EXIT
  WHEN l_end_loop;
    BEGIN
      utl_http.read_line(l_http_resp, l_buffer, true);
      IF(l_buffer IS NOT NULL AND (LENGTH(l_buffer)>0)) THEN
        l_data    := l_data||l_buffer;
      END IF;
    EXCEPTION
    WHEN utl_http.end_of_body THEN
      l_end_loop := true;
    END;
  END LOOP;
  dbms_output.put_line(l_data);
  p_response:= l_data;
  -- Look for client-side error and report it.
  IF (l_http_resp.status_code >= 400) AND (l_http_resp.status_code <= 499) THEN
    dbms_output.put_line('Check the URL.');
    utl_http.end_response(l_http_resp);
    -- Look for server-side error and report it.
  elsif (l_http_resp.status_code >= 500) AND (l_http_resp.status_code <= 599) THEN
    dbms_output.put_line('Check if the Web site is up.');
    utl_http.end_response(l_http_resp);
    RETURN;
  END IF;
  utl_http.end_response (l_http_resp);
EXCEPTION
WHEN OTHERS THEN
  dbms_output.put_line (sqlerrm);
  raise;
END;
and execution in sqldeveloper 3.2.20.09 when it connects directly to box B as scott:
 
SET serveroutput ON
DECLARE
  l_url      VARCHAR2(200)   :='http://MY_IP:8585/apex/demo';
  l_json     VARCHAR2(20000) := '{"title":"thetitle","description":"thedescription"}';
  l_response VARCHAR2(30000);
BEGIN
  post( p_url => l_url, p_message =>l_json, p_response => l_response);
END;
leading to:
 
anonymous block completed 
status code: 200
reason phrase: OK 
with data inserted. 
Installation using 2.0.1
   Workspace : wsdemo
 RESTful Service Module:  demo/
          URI Template:      test
                Method:  POST
           Source Type:  PL/SQL
and execution in sqldeveloper 3.2.20.09 when it connects directly to box B as scott:
 
SET serveroutput ON
DECLARE
  l_url      VARCHAR2(200)   :='http://MY_IP:8585//apex/wsdemo/demo/test';
  l_json     VARCHAR2(20000) := '{"title":"thetitle","description":"thedescription"}';
  l_response VARCHAR2(30000);
BEGIN
  post( p_url => l_url, p_message =>l_json, p_response => l_response);
END;
leading to:
 
status code: 500 
reason phrase: Internal Server Error 

Listener's log: 
Request Path passes syntax validation
Mapping request to database pool: PoolMap [_poolName=apex, _regex=null, _workspaceIdentifier=WSDEMO, _failed=false, _lastUpdate=1364313600000, _template=/wsdemo/, _type=BASE_PATH]
Applied database connection info
Attempting to process with PL/SQL Gateway
Not processed as PL/SQL Gateway request
Attempting to process as a RESTful Service
demo/test matches: demo/test score: 0
Choosing: oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplateDispatcher as current candidate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=2648625079503782|2797815111031405, uriTemplate=demo/test], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logonConfig=LogonConfig [logonForm=null, logonFailed=null]], originsAllowed=[], corsEnabled=true]
Determining if request can be dispatched as a Tenanted RESTful Service
Request path has one path segment, continuing processing
Tenant Principal already established, cannot dispatch
Chose oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplateDispatcher as the final candidate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=2648625079503782|2797815111031405, uriTemplate=demo/test], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logonConfig=LogonConfig [logonForm=null, logonFailed=null]], originsAllowed=[], corsEnabled=true] for: POST demo/test
demo/test is a public resource
Using generator: oracle.dbtools.rt.plsql.AnonymousBlockGenerator
Performing JDBC request as: SCOTT
Mar 28, 2013 1:29:28 PM oracle.dbtools.common.jdbc.JDBCCallImpl execute
INFO: Error occurred during execution of: [CALL, begin
 insert into scott.json_demo values(/*in:title*/?,/*in:description*/?);
end;, [title, in, class oracle.dbtools.common.stmt.UnknownParameterType], [description, in, class oracle.dbtools.common.stmt.UnknownParameterType]]with values: [thetitle, thedescription]
Mar 28, 2013 1:29:28 PM oracle.dbtools.common.jdbc.JDBCCallImpl execute
INFO: ORA-06550: line 1, column 6:
PLS-00103: Encountered the symbol "" when expecting one of the following:

   begin case declare exit for goto if loop mod null pragma
   raise return select update while with <an identifier>
   <a double-quoted delimited-identifier> <a bind variable> <<
   close current delete fetch lock insert open rollback
   savepoint set sql execute commit forall merge pipe
The symbol "" was ignored.
ORA-06550: line 2, column 74:
PLS-00103: Encountered the symbol "" when expecting one of the following:

   begin case declare end exception exit for goto if loop mod
   null pragma raise return select update while with
   <an identifier> <a double-quoted delimited-id

java.sql.SQLException: ORA-06550: line 1, column 6:
PLS-00103: Encountered the symbol "" when expecting one of the following:

   begin case declare exit for goto if loop mod null pragma
   raise return select update while with <an identifier>
   <a double-quoted delimited-identifier> <a bind variable> <<
   close current delete fetch lock insert open rollback
   savepoint set sql execute commit forall merge pipe
The symbol "" was ignored.
ORA-06550: line 2, column 74:
PLS-00103: Encountered the symbol "" when expecting one of the following:

   begin case declare end exception exit for goto if loop mod
   null pragma raise return select update while with
   <an identifier> <a double-quoted delimited-id

        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
        at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:505)
        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:223)
        at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
        at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:205)
        at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1043)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336)
        at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3612)
        at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3713)
        at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4755)
        at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1378)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at oracle.ucp.jdbc.proxy.StatementProxyFactory.invoke(StatementProxyFactory.java:242)
        at oracle.ucp.jdbc.proxy.PreparedStatementProxyFactory.invoke(PreparedStatementProxyFactory.java:124)
        at oracle.ucp.jdbc.proxy.CallableStatementProxyFactory.invoke(CallableStatementProxyFactory.java:101)
        at $Proxy46.execute(Unknown Source)
        at oracle.dbtools.common.jdbc.JDBCCallImpl.execute(JDBCCallImpl.java:44)
        at oracle.dbtools.rt.plsql.AnonymousBlockGenerator.generate(AnonymousBlockGenerator.java:176)
        at oracle.dbtools.rt.resource.templates.v2.ResourceTemplatesDispatcher$HttpResourceGenerator.response(ResourceTemplatesDispatcher.java:309)
        at oracle.dbtools.rt.web.RequestDispatchers.dispatch(RequestDispatchers.java:88)
        at oracle.dbtools.rt.web.HttpEndpointBase.restfulServices(HttpEndpointBase.java:412)
        at oracle.dbtools.rt.web.HttpEndpointBase.service(HttpEndpointBase.java:162)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.doFilter(ServletAdapter.java:1059)
        at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.invokeFilterChain(ServletAdapter.java:999)
        at com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:434)
        at oracle.dbtools.standalone.SecureServletAdapter.doService(SecureServletAdapter.java:65)
        at com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:379)
        at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
        at com.sun.grizzly.tcp.http11.GrizzlyAdapterChain.service(GrizzlyAdapterChain.java:196)
        at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
        at java.lang.Thread.run(Thread.java:662)
Error during evaluation of resource template: ORA-06550: line 1, column 6:
PLS-00103: Encountered the symbol "" when expecting one of the following:

   begin case declare exit for goto if loop mod null pragma
   raise return select update while with <an identifier>
   <a double-quoted delimited-identifier> <a bind variable> <<
   close current delete fetch lock insert open rollback
   savepoint set sql execute commit forall merge pipe
The symbol "" was ignored.
ORA-06550: line 2, column 74:
PLS-00103: Encountered the symbol "" when expecting one of the following:

   begin case declare end exception exit for goto if loop mod
   null pragma raise return select update while with
   <an identifier> <a double-quoted delimited-id
Please notify.
Concerning
Zack

Zack.L wrote:
Hi Andy,.

Sorry, I forgot to post the Source that is used by the AL1.1.4 and the AL2.0.1.

Source

begin
insert into scott.json_demo values(:title,:description);
end;

It is a failure during insertion?
Yes, he failed in the insert using AL2.0.1.

If the above statement produces the following error message:

The symbol "" was ignored.
ORA-06550: line 2, column 74:
PLS-00103: Encountered the symbol "" when expecting one of the following:

begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
 

That gives me to think that a character is not printable (notice how there is anything between the quotation marks - "") worked his way in your PL/SQL Manager. Note how the error is reported to correspond to a column 74 on line 2, line 2 of the block above has 58 characters, so a pure assumption somehow, there is extra space on line 2, which confuses the PL/SQL compiler, I suggest retype PL/SQL Manager manually and see if that solves the problem.

Tags: Database

Similar Questions

  • Advance access insert data using ViewObjects

    Hello

    I'm trying to access the data before insertion (before execution of super.doCommit ()) using viewobjects, but I only get the validated data. Is it possible to get before inserting data using viewobjects?

    The following Java code:

    String amDef = "oracle.srdemo.model.AppModule";
    Config = "AppModuleLocal";
    Am = ApplicationModule
    Configuration.createRootApplicationModule (amDef, config);
    ViewObject vo = am.findViewObject("DatetestView1");
    System.out.println ("query will return" + vo.getEstimatedRowCount () + "lines...");
    vo.executeQuery ();
    While (vo.hasNext ()) {}
    Line curPerson = vo.next ();
    System.out.println (VO.getCurrentRowIndex () +'.) "+
    "curPerson.getAttribute ("Id") + ' ' + '.
    curPerson.getAttribute ("Dataini"));
    }
    Configuration.releaseRootApplicationModule (am, true);

    I use JDeveloper 11g, a Web of Fusion and ADF business components Application

    Thanks in advance.

    You can only get data uncommitted in the session where you inserted or changed.
    If you use createRoorApplicationModule(), you always get a new session (server side), therefore, you do not see the data not validated.

    Timo

  • Replace &amp; apos; with ' in my data using pl/sql

    I want to replace all occurrences of special characters such as & apos; with ' in my data using pl/sql.

    How can I achieve this?
    set define off
    DECLARE
       firstname varchar2(200) := 'cccc'dddd';
    BEGIN
       dbms_output.put_line('Before changing : firstname :' || firstname);
       dbms_output.put_line('After changing: firstname :' || replace(firstname, ''' , chr(39)));
    END;
    /
    
    SQL> @EscapeCharTesting
    Before changing : firstname :cccc'dddd
    After changing: firstname :cccc'dddd
    
    PL/SQL procedure successfully completed.
    
  • Cannot insert data of type string/xml in table

    I am able to read the xml through utl_file. String, but I am not able to the same insert into the table through DBMS_XMLSTORE

    CDSL_UPLOAD is the download directory
    CDSL is the username

    PL, let myself be guided if something wrong with the following script

    SCRIPT OF THE TRIAL. XML FILE

    <? XML version = "1.0"? >
    < metadata >
    -zip codes >
    -< mappings Record = "4" >
    CA < STATE_ABBREVIATION > < / STATE_ABBREVIATION >
    < ZIPCODE > 94301 < / code >
    < / maps >
    -< mappings Record = "5" >
    < STATE_ABBREVIATION > CO < / STATE_ABBREVIATION >
    < ZIPCODE > 80323 < / code >
    < ZIP_CODE_EXTN > 9277 < / ZIP_CODE_EXTN >
    < / maps >
    < / zip codes >
    < / metadata >



    CREATE TABLE TRIALZIPCODES
    (
    STATE_ABBR VARCHAR2 (20) NOT NULL
    NUMBER ZIP_CODE (10, 0) NOT NULL
    , ZIP_CODE_EXT VARCHAR2 (20)
    );


    create or replace PROCEDURE first INSTANCE AS
    BEGIN
    DECLARE
    -declaring attributes

    charString varchar2 (80);
    finalStr varchar2 (4000): = null;
    whole rowsp;
    v_FileHandle UTL_FILE. TYPE_DE_FICHIER;
    l_context_handle dbms_xmlgen.ctxHandle;
    insCtx DBMS_XMLStore.ctxType;
    DNAME varchar2 (20);
    Start
    dnom: = "CDSL_UPLOAD";

    -DBMS_XMLGEN.setRowTag (ctx IN ctxHandle, rowTag IN VARCHAR2);
    -DBMS_XMLGEN.setRowSetTag (ctx IN ctxHandle, rowSetTag IN VARCHAR2);
    -the name of the table specified in our DTD
    DBMS_XMLGEN. SETROWSETTAG ("l_context_handle,'s postal Code");
    -the name of the data set as shown in our DTD
    DBMS_xmlgen.setRowTag (l_context_handle, 'mappings');
    -to get the result on the screen
    dbms_output. Enable (1000000);
    -Open the XML document in read-only mode
    v_FileHandle: = utl_file.fopen (dname, 'trial.xml', 'r');

    loop

    BEGIN

    UTL_FILE.get_line (v_FileHandle, charString);
    exception
    When no_data_found then
    UTL_FILE.fclose (v_FileHandle);
    "exit";

    END;
    dbms_output.put_line (charstring);
    If finalStr is not null then
    finalStr: = finalStr | charString;
    on the other
    finalStr: = charString.
    end if;
    end loop;
    -for the insertion of XML data in the table
    insCtx: = DBMS_XMLSTORE. NEWCONTEXT('CDSL.) TRIALZIPCODES');
    insCtx: = DBMS_XMLSTORE. INSERTXML (insCtx, finalStr); --ALSO FAILED HERE
    dbms_output.put_line ('INSERT FACT' |) To_char (rowsp));
    DBMS_XMLStore.closeContext (insCtx);
    END;

    TRIAL END;

    Procedure returns the following error
    ORA-031011 XML parsing failed
    ORA-19202 error has occurred in the processing of xml
    LPX-00222 error returned to the SAX callback function
    ORA-06512 at SYS. XMLSTORE 70 line
    ORA-06512 CDSL. FIRST line 47
    ORA-06512 line 2

    PL I want to know what is the problem with the above script

    Thank you
    Vishal

    Indeed a few questions:

    (1) I don't see what possible use of this part:

    -- DBMS_XMLGEN.setRowTag ( ctx IN ctxHandle, rowTag IN VARCHAR2);
    -- DBMS_XMLGEN.setRowSetTag ( ctx IN ctxHandle, rowSetTag IN VARCHAR2);
    -- the name of the table as specified in our DTD
    DBMS_XMLGEN.SETROWSETTAG(l_context_handle,'zipcode s');
    -- the name of the data set as specified in our DTD
    DBMS_xmlgen.setRowTag(l_context_handle,'mappings') ;
    

    (2) not really a problem, but do not use UTL_FILE to read XML files. Oracle already provides the practice of methods or procedures to read XML efficiently with an call (see examples below).

    (3) in order to use the DBMS_XMLSTORE, the names of XML elements must match the columns in the table exactly, which is not the case here. If you cannot change the structure of the XML or the structure of the table to get an exact match, you can pre-process the file (with XSLT, for example).

    So, below is an example of using DBMS_XMLSTORE and an alternative with XMLTable that offers more flexibility:

    SQL> CREATE TABLE TRIALZIPCODES (
      2    STATE_ABBREVIATION VARCHAR2(20) NOT NULL
      3  , ZIPCODE NUMBER(10, 0) NOT NULL
      4  , ZIP_CODE_EXTN VARCHAR2(20)
      5  );
    
    Table created
    
    SQL> set serveroutput on
    SQL> DECLARE
      2
      3   xmldoc   clob;
      4   insCtx   DBMS_XMLStore.ctxType;
      5   dname    varchar2(20) := 'TEST_DIR';
      6   numrows  number;
      7
      8  BEGIN
      9
     10   xmldoc := dbms_xslprocessor.read2clob(dname, 'trial.xml');
     11
     12   insCtx := DBMS_XMLStore.newContext('TRIALZIPCODES');
     13   DBMS_XMLStore.setRowTag(insCtx, 'mappings');
     14   numrows := DBMS_XMLStore.insertXML(insCtx, xmldoc);
     15
     16   dbms_output.put_line('INSERT DONE '||TO_CHAR(numrows));
     17
     18   DBMS_XMLStore.closeContext(insCtx);
     19
     20  END;
     21  /
    
    INSERT DONE 2
    
    PL/SQL procedure successfully completed
    
    SQL> select * from trialzipcodes;
    
    STATE_ABBREVIATION       ZIPCODE ZIP_CODE_EXTN
    -------------------- ----------- --------------------
    CA                         94301
    CO                         80323 9277
     
    

    Or,

    SQL> select *
      2  from xmltable('/metadata/Zipcodes/mappings'
      3         passing xmltype(bfilename('TEST_DIR', 'trial.xml'), nls_charset_id('AL32UTF8'))
      4         columns state_abbr    varchar2(20) path 'STATE_ABBREVIATION'
      5               , zip_code      number(10)   path 'ZIPCODE'
      6               , zip_code_ext  varchar2(20) path 'ZIP_CODE_EXTN'
      7       )
      8  ;
    
    STATE_ABBR              ZIP_CODE ZIP_CODE_EXT
    -------------------- ----------- --------------------
    CA                         94301
    CO                         80323 9277
     
    
  • Cannot insert data into the database

    Hello world

    I stuck with a problem in DB juice. When I try to insert data into the database using DB tool, I get a repeated error message (error 1). Please find the my vifile below and solve say.

    Problem is use Labiew 8.2. So try to answer accordingly

    Try it with a cluster instead of a string or an array.

  • HELP required on forming the matrix of data using PL/SQL

    Hi all

    I'm new on this thread and need your help in this regard.

    I have a requirement for the construction of a matrix of 5000 X 5000 using PL/SQL. My original data tables have 5000 lines each and I need to make a correlation analysis using these data and need to store in a physical table, and not in memory. This feat feasible the simple use of PL/SQL? I understand that Oracle DB has a limit of 1000 columns (but not sure) and so I would like to know if there is a workaround for this kind of scenario. If not, what are the other alternative methods to achieve this feat? Do I need to use any 3rd party tools to do this? A quick response from experts is highly appreciated.

    Thanking you in advance all the gurus.

    Rgds

    SAI

    1006089 wrote:

    I have a requirement for the construction of a matrix of 5000 X 5000 using PL/SQL.

    Possible. But this will require a large part of the memory. As PL/SQL is a language server side, this means the server's memory. That means server potential resource problems.

    And that the server environment is a multiprocessu multi-user environment, it also means potentially several copies of this code of matrix running multiple processes, each putting a request very heavy on the resources of the server. Is no longer a matter of potential server resources, but a guarantee... (exactly the same problem if you use app server architecture and Java or .net)

    You have to ask what is the cracking of data, server-side language? The answer is SQL. No PL/SQL. SQL runs rings around PL/SQL, Java, C/C++ and other languages when it comes to complex, fast and scalable, processing of large volumes of data.

    So you ask yourself why use PL/SQL? With his expensive server memory footprint? SQL and not SQL tables that are designed to deal with massive data effectively and efficiently?

  • EMERGENCY required on forming the matrix of data using PL/SQL

    Hi all

    I'm new to this thread and need your emergency assistance in this regard.

    I have a requirement for the construction of a matrix of 5000 X 5000 using PL/SQL. My original data tables have 5000 lines each and I need to make a correlation analysis using these data and need to store in a physical table, and not in memory. This feat feasible the simple use of PL/SQL? I understand that Oracle DB has a limit of 1000 columns (but not sure) and so I would like to know if there is a workaround for this kind of scenario. If not, what are the other alternative methods to achieve this feat? Do I need to use any 3rd party tools to do this? A quick response from experts is highly appreciated.

    Thanking you in advance all the gurus.

    Rgds

    SAI

    DOUBLE WIRE!

    Now that you have published in your question in the forum SQL and PL/SQL please mark this thread ANSWERED.

  • inserting rows using pl sql

    Hi all

    I created a tabale to insert a number

    create the table loc_number (c1 number);

    now, I want to insert 10 lines in this table using pl sql.

    How can I do so using pl sql?

    Hello

    Yes it is possible.

    Why use loops here?

    (I guess, you need to practice this goal)

    begin
    
     for i in 1..10
     loop
    
       insert into loc_number
           values (i);
    
     end loop;
    
     commit;
    
    end;
    
  • Problems with Insert by using dynamic Sql

    Hello
    I use the following procedure to read a BLOB after download tab-delimited text files and insert the data in a table called TBL_TMP. The columns of the table are the following: T1, T2, T3, T4, T5, T6, T7, T8, T9. I have different text files.

    Some files could fill the table until the column T8 (v_data_array (8)) and others could fill the columns up to T9 (v_data_array (9)). So I try to change this procedure in order to take account of the text file that will fill in column T9 (v_data_array (9)) but the only thing is fails for text files that fill will alone up to T8.

    The error was: ORA-01403: no data found. I tried using NVL (v_data_array (9), 'NULL'), but it does not work. How the procedure can be modified to accept two text files containing data up to columns T8 and T9.

    Thanks in advance.
    CREATE OR REPLACE PROCEDURE pr_file_upload
      (name_in IN varchar2)
    IS
    v_blob_data       BLOB; --will hold the binary structure
    v_blob_len        NUMBER; --The length of the BLOB in bytes
    v_position        NUMBER; --Will store the current position of the pointer in the blob
    v_raw_chunk       RAW(10000); --Incremental raw chunks of the BLOB will be read in the loop
    v_char            CHAR(1); --Stores the current character of the BLOB
    c_chunk_len       NUMBER := 1; --Stores the current length of the raw chunks in bytes.
    v_line            VARCHAR2 (32767) := NULL;  --Stores the value of the current line in the loop
    v_data_array      wwv_flow_global.vc_arr2;  --apex array size of 32,000
    v_name_in         VARCHAR2 (50);
    BEGIN
    
    
    -- Read data from APEX_APPLICATION_FILES view in APEX
    SELECT blob_content INTO v_blob_data
    FROM APEX_APPLICATION_FILES WHERE filename = name_in;
    
    
    v_blob_len := dbms_lob.getlength(v_blob_data);
    v_position := 1;
    
    -- Read and convert binary to char
    WHILE ( v_position <= v_blob_len ) LOOP
     v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
     v_char :=  chr(fn_hex_to_decimal(rawtohex(v_raw_chunk)));
     v_line := v_line || v_char;
     v_position := v_position + c_chunk_len;
    -- When a whole line is retrieved
     IF v_char = CHR(10) THEN
    -- Convert tab CHR(9) to : to use wwv_flow_utilities
       v_line := REPLACE (v_line, CHR(9), ':');
    -- Convert each column separated by : into array of data
       v_data_array := wwv_flow_utilities.string_to_table (v_line);
    -- Insert data into target table
       EXECUTE IMMEDIATE 'insert into TBL_TMP (t1, t2, t3, t4, t5, t6, t7, t8, t9)
        values (:1,:2,:3,:4,:5,:6,:7,:8,:9)'
        USING
          v_data_array(1),
          v_data_array(2),
          v_data_array(3),
          v_data_array(4),
          v_data_array(5),
          v_data_array(6),
          v_data_array(7),
          v_data_array(8),
          NVL(v_data_array(9),'NULL');   -- Need help here.  This is empty when reading text files that fills up to column T8.
    
    
    -- Clear out
       v_line := NULL;
      END IF;
     END LOOP;
    END;
    /

    NVL (v_data_array (9), 'NULL') will not work. Use:

    CASE WHEN v_data_array.EXISTS(9) THEN v_data_array(9) END
    

    SY.

  • Insert data using adf

    I'm begineer in the ADF and whant to insert data in the Department table, how can I do this?

    concerning

    How to go to the homepage of jdeveloper and work through some of the tutorials available?

    http://www.Oracle.com/technology/products/jdev/11/cuecards111/index.html

    Better to start is to read this blog http://blogs.oracle.com/shay/2010/02/how_do_i_start_learning_oracle_adf_and_jdeveloper.html

    Timo

  • cannot insert data into the PRODUCT_USER_PROFILE table

    I've connected to the database as the sysdba, which is installed on VMWARE. database is oracle 11g.
    whenever I insert data in the table PRODUCT_USER_PROFILE that the database returns 1 row inserted and then when I try to show everything on the table before or after the statement commit is made the database returns "No. LINES SELECTED.

    guys any idea about this problem...

    Hello

    Try to connect as a system and make the insert and check. Always think about the issue.

    -Pavan Kumar N
    Oracle 9i / 10g - OCP
    http://oracleinternals.blogspot.com/

    Published by: pounet on January 4, 2010 16:29

  • Cannot insert date values using several insert in SQL option

    Hi all

    I'm trying to insert the date in the table I created using the code mentioned below

    Insert into TRX

    ('& Trx_ID ', "& amount',' & account_no', ' & dot");

    Enter the field value: 1

    Enter the value of the quantity: 2000

    Enter the value of account_no: 1001

    Enter the value corresponding to point: February 10, 13

    After you enter the data, I get the error,

    2 old: ('& Trx_ID ', "& amount',' & account_no', ' & dot")

    2 new: ('1 ', '2000', ' 1001', February 10, 13')

    ('1 ', '2000', ' 1001', February 10, 13')

    *

    ERROR on line 2:

    ORA-00928: lack of SELECT keyword

    Kindly help me to find the error in my code.

    Thank you...

    put a key word VALUES before your brackets

    Insert... values)

    HTH

  • Cannot insert data with the PDO function [from: insert and update of the server in the same shape behaviors]

    I feel as if I'm fighting my way around a paper bag trying to insert a record.  I have recently converted from MySQL for PDP, which cannot be applied.  I'm not trying to write routines to update data and started with insert.  I tried the example in your PHP Solutions edition two, pp. 361-363, but I can't get a written account.

    It is a database, which I supported since the host server using phpMyAdmin.  I'm very well display the data on the site, so I guess that my login script is ok.  However, nothing I've tried has got a registered insert.  I tried to get back to the basics, and it still does not work.  This is my current code.  Something is wrong with my statement = $sql and I can't identify the problem.  Help, please!

    If (isset($_POST['insert'])) {}

    try {}

    create the SQL

    $sql = "INSERT INTO Homepage_text (enriched, h_date, h_seq, h_col, p_heading, p_text, h_hide) VALUES ($_POST ['enriched'], $_POST ['h_date'], $_POST ['h_seq'], $_POST ['h_col'], $_POST ['p_heading'], $_POST ['p_text'], $_POST ['h_hide']);"

    $sainttim-> execute ($sql);

    echo "new record successfully created ';

    }

    catch (PDOException ($e) exception

    {

    echo $sql. "< br / > '. $e-> getMessage();

    }

    }

    There are several things wrong with your code:

    • You use elements of an associative array within a double quoted string. Which will cause a parse error.
    • The values you are trying to insert in the database are for most (if not all) of the text fields. If you use a literal SQL query, text fields must be wrapped in quotes.
    • You try to use the method execute() with a literal SQL query. In AOP, execute() only works with a prepared statement. To run a literal SQL query, you must use the exec() method.
    • Passing the values in the array $_POST directly in the database without any sort of validation and without escaping quotes or other characters just asking for trouble.

    Follow the examples in the book, and use a prepared statement. To address all these issues quickly and easily.

  • Best practices for ViewObjects when inserting data through pl/sql procedure

    My applications is form of oracle database level enterprise application and developing now the new module of ADF 11 g but there is restriction that all insert, update, and delete data will be through procedures oracle pl/sql. Now my question is that adf pages should be linked with ViewObjects based on the entity object or Viewobjects not based on entity / sql query. Currently, I have pages with programmatic ViewObjects that don't rely on entity objects, or on the sql query. In these display objects, I create transient attributes and then used to create pages in the adf. Click Save, I extracted the data of the current line of ViewObject and pass it to the procedure. It's works well but I was wondering if this approach is ok or it is better for it. Ideally, I would like to create from EntityObject ViewObjects but don't have not find a way to sync entityObjects with the data inserted through procedures.

    Hello

    I have create an EO for database view and replace the doDML () - method. For insert/update, and delete, I call the pl/sql functions.

    See "38.5 basis an entity on a Package PL/SQL API object" in the merger Oracle® Fusion Middleware developer for Oracle application development Guide
    Framework.

  • AOP "Query was empty" [from: cannot insert data with the PDO function]

    Now try to DELETE a record.  I select a list and go to the routine to delete.  The record appears, but when I delete, I get an error saying

    Fatal error : Eception exception 'Exception PDOException' with message ' SQLSTATE [42000]: syntax error or access violation: 1065-query was empty ' in /home1/sainttim/public_html/DeleteRec.php:53 stack trace: home1/sainttim/public_html/DeleteRec.php(53) #0: PDOStatement-> execute (Array) #1 {main} thrown in /home1/sainttim/public_html/DeleteRec.php online 53

    I do not understand why the query is empty because the data are displayed on the screen, but assume that I see on the screen is not what is in the table ($_POST ['delete']).  I'm stuck!

    My code:

    $OK = false;

    $deleted = false;

    If (isset($_GET['varpage'])) {}

    $varpageSend = $_GET ['varpage'];

    $NextPage = ' DisplayText.php? varpage = ". $varpageSend;"»

    }

    If ((isset($_GET['recid'])) & & ($_GET ['recid']! = "")) {}

    $delrec = $_GET ['recid'];

    }

    on the other

    {

    $error = "record does not exist!"

    }

    If (isset($_GET['recid']) & &! $_POST)

    {

    prepare the SQL query to view folder

    $sql = "SELECT home_key, enriched, h_date, h_seq, h_col, p_heading, p_text, h_hide FROM Homepage_text WHERE home_key =?";

    RS1 $= $sainttim-> prepare ($sql);

    $OK = $rs1-> execute (array($_GET['recid']));

    $row = $rs1-> fetch();

    $home_key = $row ["home_key"];

    $textpage is "enriched" $row;.

    $h_date = $row ["h_date"];

    $h_seq = $row ["h_seq"];

    $h_col = $row ["h_col"];

    $p_heading = $row ["p_heading"];

    $p_text = $row ["p_text"];

    $h_hide = $row ["h_hide"];

    If ($h_hide == 0) {}

    $h_hide = 'n';

    }

    else {}

    $h_hide = 'y ';

    }

    If (isset ($rs1) & &! $OK) {}

    $error = $rs1-> errorInfo();

    If (isset($error[2])) {}

    store the error message if the request fails

    $error = $error [2];

    }

    }

    }


    If (isset($_POST['delete']))

    {

    NEW code

    $deletesql = "DELETE FROM Homepage_text WHERE home_key =?';"

    $stmt = $sainttim-> prepare ($deleteSQL);

    $deleted = $stmt-> execute ($row);

    If (! $deleted)

    {

    $error = "There is a problem to remove the record.";

    }

    else {}

    Header ('Location: '. $deleteGoTo);

    "exit";

    }

    }


    Form:

    Entry < h1 > delete of <? PHP echo $varpageSend;? > Page < / h1 >

    <? PHP if (isset ($error)) {}

    echo "class < p > 'errormsg' = > error:". " $error. "< /p > ';

    } ? >

    < are method = "POST" name = "form1" id = "form1" >

    < table class = "DisplayTable" align = "center" >

    < b >

    < td align = "right" > Page: < table >

    < td > <? PHP echo $textpage? > < table >

    < /tr >

    < tr valign = 'of basic">

    < td align = "right" > Date: < table >

    < td > <? PHP echo $h_date? > < table >

    < /tr >

    < b >

    < td align = "right" > sequence: < table >

    < td > <? PHP echo $h_seq? > < table >

    < /tr >

    < b >

    < td align = "right" > Col: < table >

    < td > <? PHP echo $h_col? > < table >

    < /tr >

    < b >

    < td align = "right" > title: < table >

    < td > <? PHP echo $p_heading? > < table >

    < /tr >

    < b >

    < td align = "right" > text content: < table >

    < td > <? PHP echo $p_text? > < table >

    < /tr >

    < b >

    < td align = "right" > content hide? : < table >

    < td > <? PHP echo $h_hide? > < table >

    < /tr >

    < b >

    < display td = "hidden" > < input value = <? PHP echo $delrec? > name = 'deletekey"id ="deletekey"/ > < table >

    < display td = "hidden" > < table >

    < /tr >

    < b >

    < td align = "right" > < a href = "DisplayText.php? varpage = <?" PHP echo $Thistextpage;? > "> < span class ="Red"> CANCEL </span > < /a > < table >.

    < td align = "left" > < input name = "remove" id = 'delete' type = 'submit' class = 'GreenButton"value ="Confirm deletion"/ > < table >

    < /tr >

    < /table >

    < / make >

    The reason why the query is empty lies in the lack of uniformity in the spelling of your variable to the prepared statement:

    $deletesql = "DELETE FROM Homepage_text WHERE home_key =?";

    $stmt = $sainttim-> prepare ($deleteSQL);

    The query is stored in the form of $deletesql, but the value you pass to the prepare() method is $deleteSQL. PHP variables are case-sensitive. Use is $deletesql in both cases, or store the query as $deleteSQL.

Maybe you are looking for

  • Slow down the internet using Toshiba LX830-107 running Win7

    HY I have a problem of speed limit on my Toshiba LX830-107 all-in-one with Win7 Pro 32-bit. Web from Toshiba support site, I can't find a driver for Win7 Pro 32 bit lan. I installed the driver lan for 32-bit Win8 without error, but with this speed to

  • Change FIFO size externally

    Hi all I'm using LabVIEW 2015 with FPGA module. Can you change the size of large FIFO external target (using a control, for ex, attached to the FIFO) without having to access the settings menu? Thanks in advance.

  • BlackBerry Smartphones cannot get my contacts to restore

    Backed up my curve and when I run the restoration do not return my contacts.  When I open the backup and restore, I can go to the Advanced tab and open my backup and it shows that there are 83 contacts, but it is grayed out.  How to bring back my con

  • BlackBerry smartphone how to create a URL in the Blackberry program

    Hello Can someone tell me how to create a link URL in Blackberry, which opens a web page after having been on it?

  • Cannot log in Admin account

    Original title: SOS... AS SOON AS POSSIBLE OK... I need help as soon as POSSIBLE. I am the administrator of my computer and I CAN'T GET in! I tried everything, but he still refuses to grant access. I was even denied the system recovery and Windows it