Issue of PL/SQL - conversion 250 char column field in lines - 1 characters per line

I recently started working in Oracle TOAD and was given the task of creating a SQL statement that will take eight fields of 250-column of a table and convert them to 2000 lines with line numbers.

I have no idea how to read character by character (most of the characters being blank).

How to use a variable which increases the value of a?

I tied Select substr(myFieldA,varA,1) from myTable

but he dislikes the variable, also how to make the statement in a loop.

My result will be similar to:

0001 THERE

N 0002

0003

0004 ARE...

0251 N

0252

0253. THERE

Any help will be greatly appreciated

and a few different ideas...

with t as)

Select c1 'abcdefhijk', '123456789' c2, c3 "ABCDEFGHIJK" of the double

), -t is a test of the single line "table" with 3 columns of 10 characters each

counter that)

Select the level of double connect by level<= 3="" *="">

) -meter is an array of column unique return of 30 lines with i from 1 to 30

Select counter.i rn,

substr (t.c1 | t.c2 | t.c3, counter.i, 1) c

t, counter - just them unite

order of counter.i;

Tags: Database

Similar Questions

  • ORA-06502: PL/SQL: digital error: error in the conversion of char to number

    Hello world.

    I have a strange problem here. I'll try to explain better. I work with APEX 4.2 and of Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production.

    Here are my parameters NLS_SESSION_PARAMETER and NLS_DATABASE_PARAMETER: NLS_NUMERIC_CHARACTERS,.


    I have a table with a lot of body numbers, and when I imported a MS Access application data, all fields were imported with the comma as decimal separator.


    Now, I have a form with several fields of number and when I leave a numeric field, a body of numbers of amount total is calculated and automatically filled with a bit of javascript.


    Now the problem: calculating fields (sum) succeeds only when I use the decimal as the delimiter. If I use the comma, I get a NaN value in the total amount field. I managed to convert all commas in points with javascript, so the total amount is calculated.

    When I try to save the record, I get the error: ORA-06502: PL/SQL: digital error: error in the conversion of char to number because I'm trying to save the separator point in my number fields.


    I tried to use REPLACE function to replace the. by one, before winning but does not solve the problem.


    This sounds familiar to anyone?


    Thanks in advance.



    OK, the problem is solved people.

    Somehow, the registration procedure had an influence on another calculation of my form and the error came from this process. So I put a to_number and replace stated in the calculation and all records very well and it shows my total.

  • Changing all the semantic VARCHAR2 length in BYTE to CHAR columns

    Hello

    our database is to use character set AL32UTF8, i.e. multibyte.

    All our VARCHAR2 columns have been specified as VARCHAR (xxx) semantic unspecified length explicit, which makes VARCHAR(xxx BYTE) because NLS_LENGTH_SEMANTICS is set on 'BYTE' (default Oracle).

    I wonder now if it would cause problems to enter and execute the ALTER TABLE statement to change all the columns of VARCHAR2(xxx BYTE) to VARCHAR2(xxx CHAR), leaving the same xxx. For example, if a VARCHAR2 column (100 BYTE) would be amended to be VARCHAR2(100 CHAR).

    If I am not entirely mistaken, - on the contrary - it would make the columns longer, not shorter; I expect to not get errors on the values of existing records being too long to change the specifications of the column in this way (as it may happen when the shortening of a VARCHAR column, for example, of varchar (10) to varchar (5)). So I think the ALTER TABLE statements should go without problem.

    I would also change NLS_LENGTH_SEMANTICS to TANK.

    Are there problems or consequences I might meet when I do this? I'm not worried about the implications for code enforcement external or such, but simply the integrity / performance / etc on the database level.

    It is a 11.2.0.x of Oracle database.

    Thank you

    MSA

    You can make this change to your drawings, but not for Oracle schemas or third party. It would usually not be supported.

    You will not get the errors associated with the data in the table. However, you can encounter errors due to:

    1 index of issues of key length - the maximum length of an index key in bytes (based on the column definitions, no real content column) is limited to about 70% of the size of the block of the tablespace containing the index. If you try to do a column belonging to a larger index key by applying the semantics of length in characters, you get an error if the change causes the index key limit.

    2. some columns cannot be changed. This includes, but may not be limited to, the columns that are referenced by expressions of virtual column and the functional index expressions, columns that have indexes defined on them, and columns field belonging to a partitioning key.

    3. you can not change the columns that store attributes of the type defined by the user in this way. You must change the definition of type instead.

    Also, do not change NLS_LENGTH_SEMANTICS initialization file. Include the keyword CHAR in your scripts or ALTER SESSION SET NLS_LENGTH_SEMANTICS = CHAR in these scripts. Value of the initialization file will affect all the scripts for Oracle products and third-party and can create tables with the semantics of unexpected length. Therefore, for compatibility reasons, this parameter in init.ora/spfile parameters is not recommended.

    Thank you

    Sergiusz

    Post edited by: Sergiusz Wolicki (Oracle)

  • SQL monitor help with column of chronology

    monitor_test.jpg

    In the report attached to sql, in the timeline column means the whole last 3 began simultaneously and hash join is the first exploited who started?

    my understanding is 'index range scan' should start first and give the data to "Single Partition range". Only once this step completed, he should 'TABLE ACCESS Full'. Isn't this correct?

    Thanks for your time!

    Your description is correct - and I think that you just have to allow some defects in the rounded, graphic display of errors and inconsistencies in what is "the order of execution.

    If it is still possible, you can watch dbms_sqltune.report_sql_monitor output text () as numbers COULD clarify the sequence - on the other hand, the granularity of the timer is not very fine.

    You may find that the chronology of hash join begins before the access times two table - which highlights the problem of "means to launch an operation."  The subroutine "do a hash join" must begin before the two tablescans, on the other hand the mechanism 'return rowsource to parent' cannot start until after the second table access began to return the hash join lines.

    Another sign of the available seeds, of course, is that the select statement does not seem to have started until a few seconds after the hash join has started!

    Concerning

    Jonathan Lewis

  • We are trying to make a quick payment of payment workbench and is "FRM-41830: error in values list of the no entries for payment document column / field.» Payment document format seems good. Don't know what the issue is.

    We are trying to make a quick payment of payment workbench and is "FRM-41830: error in values list of the no entries for payment document column / field.» Payment document format seems good. Don't know what the issue is.

    Found the Solution...

    PPR (profile of payment process) has not been set to check Format selected in the configuration to "Manage the payment Document".

  • SQL to update two columns in a TABLE2 from TABLE1

    I know it's a simple question for some of you, but I am new to SQLs, so please help...

    I have two tables, TABLE1 and TABLE2 as below, the two tables contains more records 50million then:
    SELECT * FROM TABLE1.
    &&&&&&&&&&&&&&&&&&&&&&&&&&&
    ID                        BUS_FID                WORKID                  STATIONID                  
    ---------------------- ---------------------- ---------------------- ---------------------- 
    28400000117234         245                    13461428.25           16520877.8             
    28400000117513         403                    13461428.25           16520877.8             
    28400000117533         423                    13461428.25           16520877.8             
    28400000117578         468                    13461428.25           16520877.8             
    28400000117582         472                    13461428.25           16520877.8             
    
    
    SELECT * FROM TABLE2.
    &&&&&&&&&&&&&&&&&&&&&&&&&&&
    BUS_FID                    ID                 TRPELID                RELPOS                 WORKID                 STATIONID                
    ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- 
    114                    28400000117658         28400000035396         23.225                                                               
    115                    28400000117659         28400000035396         23.225                                                               
    116                    28400000117660         28400000035396         23.225                                                               
    117                    28400000117661         28400000035396         23.225                                                               
    118                    28400000117662         28400000035396         23.225                                                               
    119                    28400000117663         28400000035396         23.225                                                               
    120                    28400000117664         28400000035396         23.225                                                               
    121                    28400000117665         28400000035396         23.225                                                               
    122                    28400000117666         28400000035396         23.225                                                               
    123                    28400000117667         28400000035396         23.225                                                               
    124                    28400000117668         28400000035396         23.225                                                               
    125                    28400000117669         28400000035396         23.225                                                               
    126                    28400000117670         28400000035396         23.225    
    Now, I tried to use the following SQL to update the columns ID of WORK & STATIONID in TABLE2 but failed. BUS_FID in the two tables have been UNIQUE indexed and they can be used as primary keys to join these two tables.
    UPDATE (
      SELECT  p.WORKID px,
              p.STATIONID py,
              p.BUS_FID pid,
              temp.WORKID tempx,
              temp.STATIONID tempy,
              temp.BUS_FID tempid
        FROM  TABLE1 temp, 
              TABLE2 p
        WHERE pid = tempid
    )
      SET px = tempx,
          py = tempy;
    
    COMMIT;
    with above code, Oracle gave following errors:
    SQL Error: ORA-00904: "TEMPID": invalid identifier
    00904. 00000 -  "%s: invalid identifier"
    Can someone help me fix it? Thank you ~ ~ ~
    BTW, both two tables contains documents more than 50 million. So, if you have a better SQL to perform the same task, please let me know!

    Appreciated your help in advance.

    Alias cannot be used in the query (sub-) where they are defined.

    Concerning

    Etbin

  • Issue of Oracle SQL Developer when you use VPN (Cisco)

    All,

    We have a somewhat obscure issue with connectivity SQL Developer to our databases of the laptop has distance from the employee.

    The database is hosted inside our firewall and when the employee is trying to connect to the database that it receives the following error message:
    + "Encountered error: an error has occurred to perform the requested operation: the network adapter could not establish the connection." Code provider 20 "+"

    I think maybe I saw the error at some point as well...
    Status: Failure-Test failed: IO error: the network adapter could not establish the connection

    Note: It gets this error when you are connected to our VPN & so that it can connect through SQL * more on that same basis. It gets the error without worrying if he uses the option to enter tnsnames in SQL Developer or if it uses the "basic" connection type

    What is interesting, is that if he disconnects the VPN, will turn off its wireless connectivity, then hard-wire in our network, it can connect, without issue.

    The strangest part for me, is that although it cannot connect to the database using SQL Developer, it can connect through SQL * more. It can ping the IP source address very well, he can tnsping database without problem, it can connect through SQL * Plus, it just cannot connect through SQL * Developer. Since SQL * more and tnsping work, I know that it can access the db server through port 1521, so I don't think it's a problem of port.

    Another weird thing: when it connects to our network via a 'old' virtual private network (VPN open) there is no problem.

    His machine is Windoz 64 bit (HP laptop) and it uses the latest version of the SQL Developer and a JAVA virtual machine.

    Also interesting: I also have a Windoz 64 bit computer laptop (Lenovo) and I don't have the same issues, as it does. I am however running an older version of SQL Developer and probably an older JVM.

    I dug around a bit, looks like maybe it has something to do with IPv6? No idea what to do next, except have my network guy look at the logs of firewall to try to grasp where the connectivity has been ignored.

    Any ideas or suggestions would be appreciated. I tried all sorts of things (giving him my file tnsnames.ora and sqlnet.ora, manually editing these files, try IP addresses instead of host names, host names I tried with the doman.org extensions, etc.).

    Still, any suggestion would be appreciated and I thank very you much.

    Rich

    Published by: rmurnane on October 23, 2012 10:58

    If it is IPv6, you can try adding

    AddVMOption -Djava.net.preferIPv4Stack=true
    

    at \sqldeveloper\bin\sqldeveloper.con

  • How to avoid performance issues in PL/SQL?

    How to avoid performance issues in PL/SQL?

    According to my knowledge, below a few points to avoid performance problems in PL/SQL.
    Is there any other point to avoid performance problems?

    1. use FORALL instead of the FORUM and GATHER in BULK to avoid a loop several times.
    2. RUN IMMEDIATE is faster than DBMS_SQL
    3. use NOCOPY for OUT and IN OUT if the original value need not be retained. Overhead of keeping a copy of OUT is avoided.

    Thanks for your comments Justin!

    BC explains things right on part SQL...

    http://www.DBA-Oracle.com/art_sql_tune.htm

  • Issue of PL/SQL Bulk Collect

    Hi Experts,
    I did a lot of research on this and finally decided to post a new thread, impossible to find an answer. So what we try to do is to select a few order_number a table and remove order numbers in another table. I tried without bulk collect it worked, but the treatment is too evil takes a lot of time from the table and he selects in huge therefore planned to use the COLLECTION in BULK

    CREATE OR REPLACE PROCEDURE closed_test (tabname varchar)
    is
    Type is Sub_Rp_Typ table of closed_order_cur % Rowtype;
    order_nbr_var Sub_Rp_Typ;
    v_sql varchar2 (4000);
    number of v_rowcount_int;
    number of v_rowcount_fin;
    cursor closed_order_cur is select order_nbr from closed_order;
    Start
    run immediately "select count (*) from ' |" tabname in v_rowcount_int;
    Open closed_order_cur;
    collect the fetch closed_order_cur in bulk in order_nbr_var;
    Because me in order_nbr_var... FIRST order_nbr_var. LAST loop
    v_sql: =' delete ' | tabname |' where internal_order_id = "' | order_nbr_var (i) | " ' ;
    immediately run v_sql;
    commit;
    run immediately "select count (*) from ' |" tabname in v_rowcount_fin;
    When the output closed_order_cur % notfound;
    end loop;
    dbms_output.put_line (' number of deleted rows:-' | to_char(v_rowcount_int-v_rowcount_fin,'999'));
    end;
    /

    This is my probably the easiest PL/SQL, I'm a developer ETL and put my hand around SQL procedure

    The error I get is
    LINE/COL ERROR
    -------- ----------------------------------------------------------------
    3/8 PL/SQL: ignored element
    3/36 PLS-00320: the declaration of the type of this expression is
    incomplete or incorrect

    12/4 PL/SQL: statement ignored
    12/45 PLS-00597: expression "ORDER_NBR_VAR" in the list is
    wrong type

    14/10 PL/SQL: statement ignored
    14/17 PLS-00306: wrong number or types of arguments in the call to ' |'

    your help is frequented in advance

    Thank you
    Alan

    (1) why do you need to use dynamic SQL statements? The fact that you do not know what as the name of the table that you delete but not sure he has an INTERNAL_ORDER_ID column that has an ORDER_NBR of the CLOSED_ORDER table seems pretty unlikely to me.

    (2) if effectiveness is your goal, you'll want to do everything in SQL. It all comes down to a single DELETE statement

    DELETE FROM some_table_name dest
     WHERE EXISTS(
        SELECT 1
          FROM closed_order src
         WHERE src.order_nbr = dest.internal_order_id )
    
    dbms_output.put_line( SQL%ROWCOUNT || ' rows deleted' );
    

    If you really don't know the name of the destination table, you can, of course, use dynamic SQL to create this DELETE statement.

    Justin

  • Conversion of column to the lines

    Hello
    I'm currently building and SQL to convert columns from several lines to all lines - see below the test data and the expected result:
    CREATE TABLE XX_TEST (NAME VARCHAR2 (10), A1 VARCHAR2 (10), A2 VARCHAR2 (10), A3 VARCHAR2 (10), A4 VARCHAR2 (10), A5 VARCHAR2 (10));
    INSERT INTO XX_TEST VALUES('LIST','A','B','C','D','E');
    INSERT INTO XX_TEST VALUES('L1','1',,'3',,);
    INSERT INTO XX_TEST VALUES('L2','1','5','4',,);
    ENGAGE
    SELECT * FROM XX_TEST;

    Expected result:
    NAME is the table XX_TEST column, but the COLUMN and the VALUE are converted to lines - columns

    NAME THE COLUMN VALUE
    L1 A1 1
    L1 A2 NULL
    L1 A3 3
    L1 A4 NULL
    L1 A5 NULL
    L2 A1 1
    L2 A2 5
    L2 A3 4
    L2 NULL A4
    L2 A5 NULL

    Thank you
    BS

    Hello

    user13409900 wrote:
    Thank you Alex and Frank,

    Don't foget Aketi!

    The two ways are really good and functional in my situation.
    I apologize for not giving version: I'm on 11g so I think that can use Unpivot. It would be really more faster (performance given the volume of data) to use unpivot characteristic of 11 g?

    If there is no significant difference, whereas I think is that SELECT... UNPIVOT would be faster. It is purely a guess. It depends on several factors, including your data, your index and your machine. I don't have access to one of them.

    Try both ways and compare performance. (Compare the results, too, to check that the two qiueries are really doing the same thing).
    If you need help, see this thread:
    HOW to: Validate a query of SQL statement tuning - model showing

    I've never used before unpivot.

    This sounds like a good opportunity to learn.

  • Can sql RS only 1 column of return can be printed as a separate column value

    Hello
    I wonder if the result set sql returning only one column can be printed as a separate values column?

    IE.with a simple change to select empno, emp; It should be able to print.
    101,102,103

    Instead of
    EmpNo
    ----------
    101
    102
    103

    Thank you
    Jean Claude

    Here is an example with the EMP table in the Scott schema.

    select ltrim(sys_connect_by_path(empno,','),',') empno_list
      from (select e.*, row_number() over(order by empno) rno from emp e)
     where connect_by_isleaf = 1
     start with rno = 1
    connect by rno = prior rno+1
    
  • Number of error SQL ORA-00904: invalid column name has occurred.

    Hello
    on P8.18 on a Win 2003 server when we launch SWPAUDIT, it failed with:
    Number of error SQL ORA-00904: invalid column name has occurred. Query process failed.
    I searched this error on metalink3. Nothing in connection with.

    Any idea?

    Thank you.

    Please give a clear picture of what you are doing... .and what paintings... There is the possibility of the audit refers to certain tables... with deleted. names of columns just look in the structure of what you audit?

    Please, find the name of column...

    ORA-00904: string: invalid identifier
    Cause: The column name entered is invalid or missing.
    Action: Enter a valid column name. A valid column name must start with a letter, must be less than or equal to 30 characters and include only alphanumeric characters and the special characters $, _, and #. If it contains other characters, then it must be enclosed in quotation marks. It cannot be a reserved word.

  • SQL exception while stretching, error object standard display - oracle.apps.per.selfservice.deployperson.PositionLovVO

    Hello

    SQL exception while stretching, error object standard display - oracle.apps.per.selfservice.deployperson.PositionLovVO

    When I extend the standard above mentioned display object, with a substituted view object, the region of lov throws a sql error.
    I just added an extra column in the viewobject.
    I also tried to extend the view object without adding additional columns to the query of the view object, and it always up with the exception of sql.

    I've provided steps to reporduce and test cases.

    Thank you
    Kind regards
    B.Sethuram

    Error Extension of VO - steps to reproduce

    Original view object

    Name: PositionLovVO

    Path: Oracle.apps.per.selfservice.deployperson.Server

    Request: SELECT pos.position_id position_id

    business_group_id

    date_effective

    date_end

    name postl.name

    job_id

    organization_id

    NULL effective_date

    status

    effective_start_date

    effective_end_date

    availability_status_id

    OF hr_all_positions_f pos

    hr_all_positions_f_tl postl

    Where pos.position_id = postl.position_id (+)

    AND postl.language (+) = userenv ('LANG')

    Question: The Expression of the columns of the query appears as undesirable in the XML object view and see the code «SQL...» "in VO Assistant.

    Extended view object

    Nom : XxhrPositionLovVO

    Path: xxhr. Oracle.apps.per.selfservice.deployperson.Server

    Query:

    SELECT POS.POSITION_ID position_id

    business_group_id

    date_effective

    date_end

    name postl.name

    job_id

    organization_id

    NULL effective_date

    status

    effective_start_date

    effective_end_date

    availability_status_id

    , pos.attribute5 - newly added column

    OF hr_all_positions_f pos

    hr_all_positions_f_tl postl

    where pos.position_id = postl.position_id (+)

    AND postl.language (+) = userenv ('LANG')

    A substitution JPX

    Navigation: Self - Service Manager-> GTA

    Select any employee

    Click on continue

    Click on the name of post lov

    The first time when you click on the "Go" button works as expected.

    Second time when you click on the button go-error.

    Exception details:

    Details of the exception.

    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: 27122 Houston: SQL error in the preparation of the statement.  Statement: SELECT * FROM (SELECT pos.position_id position_id, business_group_id, date_effective, date_end, postl.name name, job_id, organization_id, NULL, effective_date, status, effective_start_date, effective_end_date, availability_status_id, attribute5 FROM hr_all_positions_f pos, postl hr_all_positions_f_tl where pos.position_id = postl.position_id (+) AND postl.language (+) = QRSLT WHERE userenv ('LANG')) (business_group_id = : 1 and (to_date (: 2 "RRRR/MM/DD') between effective_start_date and effective_end_date) and organization_id =: 3 and job_id =: 4 and (status is NULL or status = 'VALID') and availability_status_id in (select shared_type_id from the PER_SHARED_TYPES where lookup_type = 'POSITION_AVAILABILITY_STATUS' and system_type_cd = 'ACTIVE') and DECODE (HR_SECURITY. VIEW_ALL, 'Y', 'TRUE', HR_SECURITY. SHOW_RECORD ('PER_ALL_POSITIONS', POSITION_ID)) = 'TRUE' and DECODE (HR_SECURITY. VIEW_ALL, 'Y', 'TRUE', HR_SECURITY. (SHOW_RECORD ('HR_ALL_ORGANIZATION_UNITS', ORGANIZATION_ID)) = 'TRUE' AND (UPPER as UPPER(:5) (NAME) AND (NAME as: like 6 OR NAME: 7 OR similar NAME: 8 OR similar NAME: 9))) ORDER BY name

    at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:912)

    at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1169)

    at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1435)

    at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:3000)

    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1884)

    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:549)

    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:437)

    at _OA._jspService(_OA.java:212)

    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)

    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)

    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)

    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

    at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)

    at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)

    at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)

    at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)

    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)

    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)

    at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)

    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)

    at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)

    at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)

    to oracle.oc4j.network.ServerSocketReadHandler$ SafeRunnable.run (ServerSocketReadHandler.java:260)

    to com.evermind.util.ReleasableResourcePooledExecutor$ MyWorker.run (ReleasableResourcePooledExecutor.java:303)

    at java.lang.Thread.run(Thread.java:619)

    # # 0 in detail

    1. java.sql.SQLException: invalid column type

    at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:8516)

    at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8034)

    at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8767)

    at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:8748)

    at oracle.jdbc.driver.OraclePreparedStatement.setObjectAtName(OraclePreparedStatement.java:11907)

    at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObjectAtName(OraclePreparedStatementWrapper.java:815)

    at oracle.jbo.server.OracleSQLBuilderImpl.bindParamValue(OracleSQLBuilderImpl.java:3966)

    at oracle.jbo.server.BaseSQLBuilderImpl.bindParametersForStmt(BaseSQLBuilderImpl.java:3335)

    at oracle.jbo.server.ViewObjectImpl.bindParametersForCollection(ViewObjectImpl.java:14008)

    at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:804)

    at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:669)

    at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3754)

    at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection (unknown Source)

    at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4560)

    at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:743)

    at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:892)

    at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:806)

    at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:800)

    at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3674)

    at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:439)

    at oracle.apps.fnd.framework.server.OAViewObjectImpl.initQuery(OAViewObjectImpl.java:743)

    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.setCriteriaOnVO(OAWebBeanHelper.java:2342)

    at oracle.apps.fnd.framework.webui.OAListOfValuesHelper.processFormRequestAfterController(OAListOfValuesHelper.java:1584)

    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:859)

    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:385)

    at oracle.apps.fnd.framework.webui.OAListOfValuesHelper.processFormRequest(OAListOfValuesHelper.java:1490)

    at oracle.apps.fnd.framework.webui.beans.layout.OAListOfValuesBean.processFormRequest(OAListOfValuesBean.java:423)

    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1039)

    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1005)

    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:860)

    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:385)

    at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)

    at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2996)

    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1884)

    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:549)

    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:437)

    at _OA._jspService(_OA.java:212)

    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)

    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)

    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)

    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

    at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)

    at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)

    at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)

    at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)

    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)

    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)

    at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)

    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)

    at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)

    at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)

    to oracle.oc4j.network.ServerSocketReadHandler$ SafeRunnable.run (ServerSocketReadHandler.java:260)

    to com.evermind.util.ReleasableResourcePooledExecutor$ MyWorker.run (ReleasableResourcePooledExecutor.java:303)

    at java.lang.Thread.run(Thread.java:619)

    1. java.sql.SQLException: invalid column type

    at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:8516)

    at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8034)

    at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8767)

    at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:8748)

    at oracle.jdbc.driver.OraclePreparedStatement.setObjectAtName(OraclePreparedStatement.java:11907)

    at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObjectAtName(OraclePreparedStatementWrapper.java:815)

    at oracle.jbo.server.OracleSQLBuilderImpl.bindParamValue(OracleSQLBuilderImpl.java:3966)

    at oracle.jbo.server.BaseSQLBuilderImpl.bindParametersForStmt(BaseSQLBuilderImpl.java:3335)

    at oracle.jbo.server.ViewObjectImpl.bindParametersForCollection(ViewObjectImpl.java:14008)

    at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:804)

    at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:669)

    at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3754)

    at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection (unknown Source)

    at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4560)

    at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:743)

    at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:892)

    at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:806)

    at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:800)

    at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3674)

    at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:439)

    at oracle.apps.fnd.framework.server.OAViewObjectImpl.initQuery(OAViewObjectImpl.java:743)

    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.setCriteriaOnVO(OAWebBeanHelper.java:2342)

    at oracle.apps.fnd.framework.webui.OAListOfValuesHelper.processFormRequestAfterController(OAListOfValuesHelper.java:1584)

    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:859)

    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:385)

    at oracle.apps.fnd.framework.webui.OAListOfValuesHelper.processFormRequest(OAListOfValuesHelper.java:1490)

    at oracle.apps.fnd.framework.webui.beans.layout.OAListOfValuesBean.processFormRequest(OAListOfValuesBean.java:423)

    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1039)

    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1005)

    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:860)

    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:385)

    at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)

    at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2996)

    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1884)

    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:549)

    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:437)

    at _OA._jspService(_OA.java:212)

    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)

    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)

    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)

    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

    at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)

    at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)

    at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)

    at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)

    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)

    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)

    at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)

    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)

    at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)

    at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)

    to oracle.oc4j.network.ServerSocketReadHandler$ SafeRunnable.run (ServerSocketReadHandler.java:260)

    to com.evermind.util.ReleasableResourcePooledExecutor$ MyWorker.run (ReleasableResourcePooledExecutor.java:303)

    at java.lang.Thread.run(Thread.java:619)

    End of the document

    Hello

    Try changing the style of binding of VO extended to positional Oracle.

    BR, 906099

  • How to make SQL * more count the comment and blank line numbers?

    Hello

    Parameter
    Value of the parameter
    Oracle versionEnterprise Edition Release 11.2.0.1.0 - 64 bit
    OPERATING SYSTEMLinux Fedora Core 17 (X86_64)

    I would like to know, is it possible to force SQL * Plus to provide the number of the current in the source file line whenever there is an error? I often put in the first line of my script SQLBLANKLINES the VALUE ON that I may be able to put several consecutive blank lines in my code (I do that sometimes, when I find that it is appropriate to make my code more readable or a sequence of instructions which I believe make their logic more comprehensible for the reader of the Group)

    Now the problem is that SQL * Plus will ignore these empty lines and whenever there is an error, the line number in the error message does not match the actual line number in the source file, but it seems to be the last non-empty line in the file.  Consider the following example:

    SET SQLBLANKLINES ON;

    DECLARE
        var PLS_INTEGER := 10;
    BEGIN


       
        var := 20
    END;
    /

    In the code above on line 9 (also counting blank lines), there is an error (no semicolon at the end of the var: = 20) but when I run the script

    SQL * also, here is the error message I get


    SQL > @myscript.sql;

    END;

    *

    ERROR on line 8:

    ORA-06550: line 8, column 1:

    PLS-00103: encountered the symbol "END" when expected in the following way:

    * & = - + ; <>/ is mod remains not rem

    < an exponent (*) > <>or! = or ~ = > = < = <>and like2 or

    like4 likec between | submultiset of type multiset Member

    The symbol ';' was replaced by 'END' continue.


    SQL >


    As you can see the error message indicates that the error was found on line 8, while in the file, it's really on line 9

    As long as the number of lines in the script is limited, this may not be a problem and we can quickly find the actual line number in the code that causes the error, but for a code, including hundreds (or even thousands) of lines and with many comments and blank lines, find line number given by SQL * error message more becomes complicated.

    So my question: is it possible to make SQ * more properly draw the line numbers, as they appear in the source file?

    Thanks in advance,

    Kind regards

    Dariyoosh

    Hi, Dariyoosh,

    The line numbers in error messages are always from the beginning of the statement, but not the file.  The back-end which checks the errors and generates the error message, has no idea if this statement has appeared in your file, even if the statement was in a file at all, or if it comes from multiple files, each with its own line 1.

    You can divide your scripts into parts, so that the long statements, which may lead to error messages, are each in a separate file, so the statement starts on the line 1 of the file.

    For example, you can call a script called fubar.sql, which looks like this:

    SET SQLBLANKLINES ON;
    
    @@fubar_1
    

    Which calls another script, called fubar_1.sql, located on the same directory as fubar.sql, that looks like this

    DECLARE
        var PLS_INTEGER := 10;
    BEGIN
    
        var := 20
    END;
    /
    

    You never call him directly fubar_1.

  • Order of columns in a line

    Hello

    I'm fighting to solve a problem. I want to sort the values of the fields in each line.

    RDBMS: 11.2.0.3
    CREATE TABLE test_order
      (a NUMBER, b NUMBER ,c NUMBER ,d NUMBER
      );
    
    REM INSERTING into test_order
    Insert into "test_order" (A,B,C,D) values ('18','29','14','21');
    Insert into "test_order" (A,B,C,D) values ('40','11','29','12');
    Insert into "test_order" (A,B,C,D) values ('22','20','19','24');
    
    select * from test_order
    
             A          B          C          D
    ---------- ---------- ---------- ----------
            18         29         14         21 
            40         11         29         12 
            22         20         19         24 
    I'm trying to get the result in the order as listed below IS NOT question of name of column.

    Each line ordered by its own columns.
             A          B          C          D
    ---------- ---------- ---------- ----------
            14         18         21         29 
            11         12         29         40 
            19         20         22         24 
    Note: my real table have more than 1 million records.

    Any help is welcome.

    Seeing as Frank is also fun with this, and I get bored, I look at a data pump import ticking on the partition in the partition, I thought to create a called TSortedNumbers - SQL data type that allows you to create/store a set of numbers in a sorted list and providing a method to return a specific element in the game.

    As the PL/SQL code should be used to replace the default constructor, I decided to use a PL/SQL quicksort on the list of numbers - that oppose a context switching expensive in SQL for SQL did sort it out for you. No idea what (if any) of the performance improvements it use a quicksort PL/SQL.

    However, it shows the really kewl and awesome features Oracle provides in allowing to define custom types SQL.

    // TNumbers is an array/collection of numbers
    SQL> create or replace type TNumbers as table of number;
      2  /
    
    Type created.
    
    // package Lib, implements the well-known Quick Sort algorithm - and sorts an
    // array of numbers, where the array is of data type TNumbers
    SQL> create or replace package Lib is
      2          procedure QuickSort( array in out nocopy TNumbers );
      3  end;
      4  /
    
    Package created.
    
    SQL>
    SQL> create or replace package body Lib is
      2          procedure SwapPivots( array in out nocopy TNumbers, pivot1 number, pivot2 number ) is
      3                  pivotValue      number;
      4          begin
      5                  pivotValue := array(pivot1);
      6                  array(pivot1) := array(pivot2);
      7                  array(pivot2) := pivotValue;
      8          end;
      9
     10          procedure  Partition( array in out nocopy TNumbers, left number, right number, pivotIndex number, storeIndex out number ) is
     11                  pivotValue      number;
     12          begin
     13                  pivotValue := array(pivotIndex);
     14                  SwapPivots( array, pivotIndex, right );
     15                  storeIndex := left;
     16                  for i in left..right - 1 loop
     17                          if array(i) < pivotValue then
     18                                  SwapPivots( array, i, storeIndex );
     19                                  storeIndex := storeIndex + 1;
     20                          end if;
     21                  end loop;
     22                  SwapPivots( array, storeIndex, right );
     23          end;
     24
     25          procedure QuickSort( array in out nocopy TNumbers, left number, right number ) is
     26                  pivotIndex      number;
     27                  pivotNewIndex   number;
     28          begin
     29                  if left < right then
     30                          pivotIndex := trunc( DBMS_RANDOM.value( left, right ) );
     31
     32                          Partition( array, left, right, pivotIndex, pivotNewIndex );
     33                          QuickSort( array, left, pivotNewIndex-1 );
     34                          QuickSort( array, pivotNewIndex+1, right );
     35                  end if;
     36          end;
     37
     38          procedure QuickSort( array in out nocopy TNumbers ) is
     39          begin
     40                   QuickSort( array, 1, array.Count );
     41          end;
     42
     43  end;
     44  /
    
    Package body created.
    
    // We define a a custom SQL data type that contains a single property called n,
    // where n is of type TNumber.
    // The default constructor for this type is: TSortedNumbers (  create or replace type TSortedNumbers is object(
      2          n       TNumbers,
      3
      4          constructor function TSortedNumbers(n TNumbers) return self as result,
      5          member function Get(i integer) return number
      6  );
      7  /
    
    Type created.
    
    // Using our custom constructor, we accept the array-of-numbers parameter,
    // assign it to our  TSortedNumbers property n, and quick sort our property so
    // that the array-of-numbers is in ascending values.
    // We also provide a method called Get(), that allows the caller to get a value
    // from our sorted array, by index number.
    SQL> create or replace type body TSortedNumbers as
      2          constructor function TSortedNumbers(n TNumbers) return self as result is
      3          begin
      4                  self.n := n;
      5                  Lib.QuickSort(self.n);
      6                  return;
      7          end;
      8
      9          member function Get(i integer) return number is
     10          begin
     11                  return( self.n(i) );
     12          end;
     13
     14  end;
     15  /
    
    Type body created.
    
    // Create sample table and populate it with data
    SQL> create table testtab( a number, b number, c number, d number );
    
    Table created.
    
    SQL>
    SQL> insert into testtab (A,B,C,D) values ('18','29','14','21');
    
    1 row created.
    
    SQL> insert into testtab (A,B,C,D) values ('40','11','29','12');
    
    1 row created.
    
    SQL> insert into testtab (A,B,C,D) values ('22','20','19','24');
    
    1 row created.
    
    // To create an array of numbers, we use the TNumbers() data type. Its
    // constructor  is TNumbers( num1, num2, .., numn ). We pass the columns of
    // the rows as parameters into this constructor and it creates an array of our
    // column values. As we now have an array-of-numbers, we can instantiate a
    // TSortedNumbers object. Its constructor required an array-of-numbers
    // parameter. Which is what we have created using our row's columns.
    // As the TSortedNumbers object contains a sorted array-of-numbers of our
    // columns, we can display the numbers in the array using the Get() method
    // and index position in the array of the number we want to display.
    SQL> with results as(
      2  select
      3          rownum,
      4          t.*,
      5          TSortedNumbers( TNumbers(a,b,c,d) ) as NUMBER_SET
      6  from       testtab t
      7  )
      8  select
      9          r.number_set.Get(1)     as "1",
     10          r.number_set.Get(2)     as "2",
     11          r.number_set.Get(3)     as "3",
     12          r.number_set.Get(4)     as "4"
     13  from       results r
     14  /
    
             1          2          3          4
    ---------- ---------- ---------- ----------
            14         18         21         29
            11         12         29         40
            19         20         22         24
    
    SQL>
    

    Published by: Billy Verreynne on April 13, 2013 18:04 (comments added for example)

Maybe you are looking for