Lines of columns within PL/SQL or sql.

Hi I need to get this data, which are retrieved using a query sql with a prerequisite by clause and are displayed as lines. for display in a separate on one... rank column, the values must be in their own column on the same line...

tabular presentation
 Level 1   Level2     Level3    Level4    Level5  
column1     column2     column3
270767     197851            1
64631     230693            2
33115     230481            3
229148     209655            4
 
So, I need to enter these lines in the columns of the table... But the lines can be up to 11 and beyond so I'll create a table with many columns, but for now
just using 5, but I want the script, so it can just keep going through the columns not only limited to 5...

This query you posted could be reduced up to...

select max(decode(hierarchy_level,1,subordinate_position_id)) as number1
      ,max(decode(hierarchy_level,2,subordinate_position_id)) as number2
      ,max(decode(hierarchy_level,3,subordinate_position_id)) as number3
      ,max(decode(hierarchy_level,4,subordinate_position_id)) as number4
      ,max(decode(hierarchy_level,5,subordinate_position_id)) as number5
      ,max(decode(hierarchy_level,6,subordinate_position_id)) as number6
      ,max(decode(hierarchy_level,7,subordinate_position_id)) as number7
      ,max(decode(hierarchy_level,8,subordinate_position_id)) as number8
      ,max(decode(hierarchy_level,9,subordinate_position_id)) as number9
      ,max(decode(hierarchy_level,10,subordinate_position_id)) as number10
      ,max(decode(hierarchy_level,11,subordinate_position_id)) as number11
      ,max(decode(hierarchy_level,12,subordinate_position_id)) as number12
      ,max(decode(hierarchy_level,13,subordinate_position_id)) as number13
      ,max(decode(hierarchy_level,14,subordinate_position_id)) as number14
      ,max(decode(hierarchy_level,15,subordinate_position_id)) as number15
from
     (SELECT pos.subordinate_position_id
            ,LEVEL AS hierarchy_level
      FROM   apps.per_pos_structure_elements pos,
            (select paf.position_id,paf.person_id
             from   per_all_assignments_f paf
             where  sysdate between paf.effective_start_date and paf.effective_end_date
             and    paf.assignment_type = 'E') people_data
      WHERE  pos.pos_structure_version_id = 103
      and    pos.subordinate_position_id = people_data.position_id (+)
      CONNECT BY PRIOR pos.parent_position_id = pos.subordinate_position_id
      AND pos.pos_structure_version_id = 103
      START WITH pos.subordinate_position_id = 197851
     )

Tags: Database

Similar Questions

  • ORA-06550: line 21, column 5: PLS-00306: wrong number or types of arguments

    Dear Sir

    can someone help what is the problem?
    I get the error message:
    ORA-06550: line 21, column 5: PLS-00306: wrong number or types of arguments in the call to 'STRONG_PASSWORD_VALIDATION' ORA-06550: line 21, column 5: PL/SQL: statement ignored

    code is:
    ---
    DECLARE
    l_username varchar2 (100);
    l_password varchar2 (100);
    l_old_password varchar2 (100);
    l_workspace_name varchar2 (30);
    l_min_length_err boolean;
    l_new_differs_by_err boolean;
    l_one_alpha_err boolean;
    l_one_numeric_err boolean;
    l_one_punctuation_err boolean;
    l_one_upper_err boolean;
    l_one_lower_err boolean;
    l_not_like_username_err boolean;
    l_not_like_workspace_name_err boolean;
    l_not_like_words_err boolean;
    BEGIN
    l_username: =: P29_CURR_USER;
    l_password: =: P29_NEW_PW;
    l_old_password: =: P29_PW;
    l_workspace_name: = APEX_UTIL. GET_DEFAULT_SCHEMA;
    APEX_UTIL. () STRONG_PASSWORD_VALIDATION
    p_username = > l_username,.
    p_password = > l_password,
    p_old_password = > l_old_password,
    p_workspace_name = > l_workspace_name,
    p_use_strong_rules = > false,
    p_min_length_err = > l_min_length_err,
    p_new_differs_by_err = > l_new_differs_by_err,
    p_one_alpha_err = > l_one_alpha_err,
    p_one_numeric_err = > l_one_numeric_err,
    p_one_punctuation_err = > l_one_punctuation_err,
    p_one_upper_err = > l_one_upper_err,
    p_one_lower_err = > l_one_lower_err,
    p_not_like_username_err = > l_not_like_username_err,
    p_not_like_workspace_name_err = > l_not_like_workspace_name_err,
    p_not_like_words_err = > l_not_like_words_err
    );

    IF l_min_length_err THEN
    return ('Kennwort ist zu kurz');
    END IF;

    IF l_new_differs_by_err THEN
    return ("' muss sich vom alten Kennwort unterscheiden Kennwort");
    END IF;

    IF l_one_alpha_err THEN
    return ('wenigstens einen letter included muss Kennwort');
    END IF;

    IF l_one_numeric_err THEN
    return ('wenigstens eine Ziffer included muss Kennwort');
    END IF;

    IF l_one_punctuation_err THEN
    return ('wenigstens ein Sonderzeichen included muss Kennwort');
    END IF;

    IF l_one_lower_err THEN
    return ('wenigstens einen Kleinbuchstaben included muss Kennwort');
    END IF;

    IF l_one_upper_err THEN
    return ('wenigstens einen Grossbuchstaben included muss Kennwort');
    END IF;

    IF l_not_like_username_err THEN
    return ('Kennwort darf nicht den included Nick');
    END IF;

    IF l_not_like_workspace_name_err THEN
    return ('Kennwort darf nicht den Namen-Workspace included');
    END IF;

    IF l_not_like_words_err THEN
    Return ("' contains unerlaubten term Kennwort") End Function
    END IF;
    Returns a null value.
    END;
    ---
    Any help is welcome.
    Kind regards
    Lorenz

    Look in your version of apex_util. Your code certainly doesn't look like using STRONG_PASSWORD_VALIDATION, which has very different parameters.

    My version (4.0) of STRONG_PASSWORD_CHECK has 16 parameters, your code has 15.

  • Write a SQL query with lines in columns

    All the

    I need help in writing a SQL query with lines in columns, let give u an example...

    drop table activity;

    CREATE TABLE 'ACTIVITY '.

    (

    "PROJECT_WID" NUMBER (22.0) NOT NULL,

    VARCHAR2 (150 CHAR) "PROJECT_NO."

    VARCHAR2 (800 CHAR) 'NAME '.

    );

    Insert in the ACTIVITY (PROJECT_WID, PROJECT_NO, NAME) values (1683691, '10007', 12-121');

    Insert in the ACTIVITY (PROJECT_WID, PROJECT_NO, NAME) values (1684994, '10008', 12-122');

    Insert in the ACTIVITY (PROJECT_WID, PROJECT_NO, NAME) values (1686296, '10009', 12-123');

    Insert in the ACTIVITY (PROJECT_WID, PROJECT_NO, NAME) values (2225222, '9040', 12-124');

    drop table lonet;

    CREATE TABLE 'LONET.

    (

    VARCHAR2 (150 CHAR) "NAME."

    NUMBER OF THE "ROOT."

    VARCHAR2 (150 CHAR) "ENTRYVALUE".

    );

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ("GAC", 1683691, "LDE");

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('NAM', 1683691, 'LME');

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('BAG', 1683691, 'ICE');

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('PAP', 1683691, 'IKE');

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('NAM', 1686291, "QTY");

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('PAP', 1686291, 'MAX');

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ("GAC", 1684994, "MTE");

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('PAP', 1684994, 'MAC');

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('FMT', 1684994, 'NICE');

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('FMR', 1684994, 'RAY');

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('BAG', 1686296, "CAQ");

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ("PAP", 1686296, "QAQ");

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ("VANESSA", 1686296, "THEW");

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ("ANDR", 1686296, "REYL");

    commit;

    Link: activity.project_wid = lonet.root

    look like output

    Project_wid Project_no NAME GAC NAM BAG RAC
    16836911000712-121LDELMELCELKE
    16849941000812-122MTEnullnullMAC
    16862961000912-123nullnullCAQQAQ
    2225222904012-124nullnullnullnull

    two problems, in that I am running

    1. I dono how simply we can convert rows to columns

    2. for root = 1683691, there are double NAM and RAC in lonet table... ideally these data should not be there, but since its here, we can take a MAX so that it returns a value

    3. There are undesirables who should be ignored

    Once again my thought process is that we join the activity and 4 alias table lonet.

    ask for your help in this

    Thank you

    Hello

    This is called pivoting.

    Here's a way to do it:

    WITH relevant_data AS

    (

    SELECT a.project_wid, a.project_no, b.SID

    , l.name AS lonet_name, l.entryvalue

    Activity one

    LEFT OUTER JOIN lonet l.root = a.project_wid l

    )

    SELECT *.

    OF relevant_data

    PIVOT (MAX (entryvalue)

    FOR lonet_name IN ("GAC" IN the gac

    "NAM" AS nam

    'BAG' IN the bag

    "RAC" AS cars

    )

    )

    ORDER BY project_wid

    ;

    Output:

    PROJECT_WID PROJECT_NO GAC NAM BAG RAC NAME

    ----------- ---------- ---------- ---------- ---------- ---------- ----------

    1683691 12 - 10007 121 LDE LME LCE LKE

    1684994 MAC MTE 10008 12-122

    1686296 12 - 10009 123 QAC QAQ

    2225222 9040 12 - 124

    To learn more about swivel, see the FAQ in the Forum: Re: 4. How can I convert rows to columns?

    Thanks for posting the CREATE TABLE and INSERT statements; It's very useful!

  • error in pseudo-column "DECODE" can be used within an SQL statement

    Hi gurus,

    Your help is grealty appreciated. Please help me.


    I'm trying to see if I can use the function decode as below and get the error, here below vPlatformfrom value would be QA or MTS


    vDataBase1 :='@'|| Decode (vPlatformfrom, 'STD', 'STD', 'QA', 'QA')


    Before we check function NVL to a single platform, but now we need the database based on the platform is here.

    -vDataBase1 :='@'|| NVL (vPlatformto, 'MTS');

    Error:

    PLS-00204: pseudo-column "DECODE" or function may be used within an SQL statement

    > So, here, instead of the decode function, I can use this case as below:

    Well... you can, but why?  In your CASE, you simply return the same value as the variable.

    You might as well use: vDataBase1: = vPlatformfrom;  It would reach exactly the same thing.

    If vPlatformfrom can be a null value, you will need to decide what database to use or an exception.  I think you're original code (NVL) were probably more correct, but I can't decide which.

    (and don't bother selecting double, it is an unnecessary sql statement which must be analysed, etc..)

  • Help: java.sql.SQLException: ORA-06550: line 1, column 7:, PLS-00201:

    Who can give me a hand to settle the question below? I use the db 11G for two or three days. This works. But now it displays information below, it blocks my server needs to be in place. Can anyone help to take a look? And explain to me what is meaning with below question?

    Thank you


    java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00201: identifier ' INVALIDHTOMEH. KEEP ' should be declared

    oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
    11/08/05 02:18:17-oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
    11/08/05 02:18:17-oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
    11/08/05 02:18:17-oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
    11/08/05 02:18:17-oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:184)
    11/08/05 02:18:17-oracle.jdbc.driver.T4CCallableStatement.execute_for_rows(T4CCallableStatement.java:873)
    11/08/05 02:18:17-oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1161)
    11/08/05 02:18:17-oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3001)
    11/08/05 02:18:17-oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3093)
    11/08/05 02:18:17-oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4286)
    11/08/05 02:18:17-com.agile.pc.cmserver.util.OracleIDGenerator.pinSequence(OracleIDGenerator.java:245)
    11/08/05-02:18:17-com.agile.pc.cmserver.util.OracleIDGenerator. < init > (OracleIDGenerator.java:62)
    11/08/05 02:18:17-com.agile.pc.cmserver.util.CMUtilReflection.getOracleIDGenerator(CMUtilReflection.java:79)
    11/08/05 02:18:17-com.agile.util.dao.IDGenerator.getNewInstance(IDGenerator.java:78)
    11/08/05 02:18:17-com.agile.util.dao.IDGenerator.getInstance(IDGenerator.java:66)
    11/08/05 02:18:17-com.agile.util.dao.IDGenerator.getNextID(IDGenerator.java:91)
    11/08/05-02:18:17-com.agile.util.AppServerId. < clinit > (AppServerId.java:14)
    11/08/05 02:18:17-com.agile.startup.PCMStartupImpl.start(PCMStartupImpl.java:115)
    11/08/05 02:18:17-com.agile.ui.pcm.InitServlet.init(InitServlet.java:63)
    11/08/05 02:18:17-com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2379)
    11/08/05 02:18:17-com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4830)
    11/08/05 02:18:17-com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4754)
    11/08/05 02:18:17-com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:4942)
    11/08/05 02:18:17-com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1144)
    11/08/05-02:18:17-com.evermind.server.http.HttpApplication. < init > (HttpApplication.java:741)
    11/08/05 02:18:17-com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:431)
    11/08/05 02:18:17-com.evermind.server.Application.getHttpApplication(Application.java:586)
    11/08/05 02:18:17-com.evermind.server.http.HttpSite$ HttpApplicationRunTimeReference.createHttpApplicationFromReference (HttpSite.java:1987)
    11/08/05 02:18:17-com.evermind.server.http.HttpSite$ HttpApplicationRunTimeReference. < init > (HttpSite.java:1906)
    11/08/05 02:18:17-com.evermind.server.http.HttpSite.initApplications(HttpSite.java:643)
    11/08/05 02:18:17-com.evermind.server.http.HttpSite.setConfig(HttpSite.java:290)
    11/08/05 02:18:17-com.evermind.server.http.HttpServer.setSites(HttpServer.java:270)
    11/08/05 02:18:17-com.evermind.server.http.HttpServer.setConfig(HttpServer.java:177)
    11/08/05 02:18:17-com.evermind.server.ApplicationServer.initializeHttp(ApplicationServer.java:2493)
    11/08/05 02:18:17-com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1042)
    11/08/05 02:18:17-com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:131)

    Published by: user774630 on November 4, 2008 18:57

    # com.agile.pc.cmserver.util.OracleIDGenerator.pinSequence(OracleIDGenerator.java:245)

    This method tries to pin a sequence in the Shared Pool so that it is not recharged. Reloading can cause sequence numbers to be ignored, if I remember correctly.
    Pinning is done using packed the INVALIDHTOMEH procedure. KEEP. The error is reported because either the package INVALIDHTOMEH is not created in the database (the $ORACLE_HOME/rdbms/admin/dbmspool.sql script creates) or the user who connects to the database have not run privilege for the package.

    Note that the package has access to the shared swimming pool. Execute privilege to grant only trusted users.

    -Sergiusz

  • Column name is SQL

    Hello

    I have a column named "SQL" in my table. When I try to create a form based on that table (which includes this column and all others in the table) by using the wizard, I get the error "column names must be valid identifiers to Oracle." Does perform a work around where I'm misunderstanding this error message for another problem? Thank you.

    Suni

    Hmm... It's a little strange.

    "SQL" doesn't seem to be a reserved word.
    http://download-West.Oracle.com/docs/CD/B19306_01/EM.102/b40103/app_oracle_reserved_words.htm#CHDCGECI

    DNA, it does not give an error when used in the instructions of the Oracle... Unlike other reserved words... like 'DATE'.

    sql> create table t(
      2    id number,
      3    sql varchar2(20));
    
    Table created.
    
    sql> insert into t (id,sql ) values (10,'select * from t');
    
    1 row created.
    
    sql> select id, sql from t;
    
            ID SQL
    ---------- --------------------
            10 select * from t
    
    sql> alter table t drop column sql;
    
    Table altered.
    
    sql> alter table t add (sql varchar2(20));
    
    Table altered.
    
    sql> alter table t add (date date);
    alter table t add (date date)
                       *
    ERROR at line 1:
    ORA-00904: : invalid identifier
    

    Apparently it's a word reserved in pl/sql.
    http://download-West.Oracle.com/docs/CD/B19306_01/AppDev.102/b14261/reservewords.htm

    sql> declare
      2     sql varchar2(20);
      3  begin
      4     null;
      5  end;
      6  /
       sql varchar2(20);
       *
    ERROR at line 2:
    ORA-06550: line 2, column 4:
    

    As suggested earlier, it is better to rename the column... probably in sql_text to avoid other problems.

    Edited by: February 1, 2010 15:34

  • How we get enough space for a column in the SQL report?

    How did one reserves enough spaces for a column in the SQL report?

    Ex: 2 columns defined as follows

    projectNo varchar2 (10)
    ProjectName varchar2 (50)

    When creating a sql, the report header report will show below. If my project name is 'Tire force Test site R987654'. I need to show in a single line, since it has been defined as varchar2 (50)
    projectNo     ProjectName
    A0001         Tire Strength
                  Test At Site
                  R987654 
    It have a way to get around here. Thanks in advance.

    Tai

    You can enter "space: nowrap;" in the CSS Style of the column, or, better yet, to set a CSS class to it.

    HTH,
    Chris

  • to DECLARE * ERROR at line 1: ORA-00900: invalid SQL statement

    This works fine when I use the System user to create a schema and then run this script.
    When I create another user with grant connect, resources, create view permissions I get this error:

    DECLARE
    *

    ERROR on line 1:
    ORA-00900: invalid SQL statement
    ORA-06512: at...


    DECLARE
    ID MY_TABLE.ID%TYPE;
    tNom my_table. % TABLENAME TYPE;
    PName MY_TABLE_TWO. PROPERTYNAME % TYPE;
    CURSOR c1 IS
    SELECT distinct evt.id, evt. TABLENAME, vid.propertyname
    FROM my_table evt, vid MY_TABLE_TWO
    WHERE the evt. COL_1 = 1
    AND evt. COL_2 = vid. COL_2
    and not exists (select facts FROM MY_TABLE_THREE 1)
    where evt.id = facts.eventid and facts.displayname = vid.propertyname);
    BEGIN
    OPEN c1;
    LOOP
    FETCH c1 INTO id, tNom, pname;
    OUTPUT WHEN c1% NOTFOUND;
    INSERT INTO MY_TABLE_THREE (ID, COLUMNLENGTH)
    VALUES (S_ANALYTICS_SEQUENCE.nextval, 255);
    RUN IMMEDIATELY 'ALTER TABLE ' | tNom | 'Add ' | PName | ' _ NVARCHAR2 (255);
    END LOOP;
    CLOSE c1;
    END;

    Hello

    Maybe missing a privilege. If I were you, I'll try this first:

    DECLARE
       id    MY_TABLE.ID%TYPE;
       tname MY_TABLE.TABLENAME%TYPE;
       pname MY_TABLE_TWO.PROPERTYNAME%TYPE;
       CURSOR c1 IS
          SELECT DISTINCT evt.id,
                          evt.TABLENAME,
                          vid.propertyname
            FROM MY_TABLE     evt,
                 MY_TABLE_TWO vid
           WHERE evt.COL_1 = 1
             AND evt.COL_2 = vid.COL_2
             AND NOT EXISTS (SELECT 1
                    FROM MY_TABLE_THREE facts
                   WHERE evt.id = facts.eventid
                     AND facts.displayname = vid.propertyname);
    BEGIN
       OPEN c1;
       LOOP
          FETCH c1
             INTO id, tname, pname;
          EXIT WHEN c1%NOTFOUND;
          INSERT INTO MY_TABLE_THREE
             (ID,
              COLUMNLENGTH)
          VALUES
             (S_ANALYTICS_SEQUENCE.NEXTVAL,
              255);
          DBMS_OUTPUT.put_line('ALTER TABLE ' || tname || ' add ' || pname ||
                               '_ NVARCHAR2(255)');
          --EXECUTE IMMEDIATE 'ALTER TABLE ' || tname || ' add ' || pname || '_ NVARCHAR2(255)';
       END LOOP;
       CLOSE c1;
    EXCEPTION
       WHEN OTHERS THEN
          DBMS_OUTPUT.put_line(SQLERRM);
    END;
    /
    

    Using this approach, you can see the sentences to run without run, I also added an exception block.

    Kind regards

  • SQL Analysis: Extract column expression and SQL query tags

    Hi all

    I have a requirement and posted earlier reg. this.
    An SQL statement must be parsed and column names must be extracted separately.
    I can't use dbms_sql. I need to extract the names of columns through manipulating strings in PL/SQL only.
    I don't have to validate the SQL code.

    for example.
    SELECT EMPNO, Upper (ENAME), DEPTNO Emp_Name, DECODE (Deptno, 10, 'ACCOUNTING', 20, 'HR', 'OTHER') Dept_Name OF double

    Output should be,.

    Column names
    --------------------
    (1) EMPNO
    (2) Emp_Name Upper (ENAME)
    (3) DEPTNO
    (4) Dept_Name DECODE(Deptno,10,'ACCOUNTING', 20,'HR','OTHERS')

    How can I retrieve the names of columns using PL/SQL for the above format?
    Pls help.

    Kind regards
    Sam

    If the requirement is to have them come forward...

    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2    v_sql VARCHAR2(4000) := q'[SELECT EMPNO, Upper(ENAME) Emp_Name, DEPTNO, DECODE(Deptno,10,'ACCOUNTING', 20,'HR','OTHERS') Dept_Name FROM Dual]';
      3    v_cols VARCHAR2(4000) := regexp_replace(v_sql, 'SELECT (.*) FROM .*', '\1');
      4    PROCEDURE parse_col(p_cols IN VARCHAR2, lvl NUMBER) IS
      5      v_str VARCHAR2(4000);
      6      v_br  NUMBER := 0;
      7      v_pos NUMBER := 1;
      8    begin
      9      LOOP
     10        EXIT WHEN v_pos > length(p_cols);
     11        CASE SUBSTR(p_cols,v_pos,1)
     12          WHEN '(' THEN
     13            v_br := v_br + 1;
     14          WHEN ')' THEN
     15            v_br := v_br - 1;
     16          WHEN ',' THEN
     17            IF v_br = 0 THEN
     18              DBMS_OUTPUT.PUT_LINE(to_char(lvl,'fm99')||': '||trim(v_str));
     19              parse_col(SUBSTR(p_cols,v_pos+1),lvl+1);
     20              v_str := NULL;
     21              EXIT;
     22            END IF;
     23          ELSE NULL;
     24        END CASE;
     25        v_str := v_str || SUBSTR(p_cols,v_pos,1);
     26        v_pos := v_pos + 1;
     27      END LOOP;
     28      IF v_str IS NOT NULL THEN
     29        DBMS_OUTPUT.PUT_LINE(to_char(lvl,'fm99')||': '||trim(v_str));
     30      END IF;
     31    end;
     32  begin
     33    parse_col(v_cols,1);
     34* end;
    SQL> /
    1: EMPNO
    2: Upper(ENAME) Emp_Name
    3: DEPTNO
    4: DECODE(Deptno,10,'ACCOUNTING', 20,'HR','OTHERS') Dept_Name
    
    PL/SQL procedure successfully completed.
    
    SQL>
    
  • ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments

    Hi all
    Here is the error:
    ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments
    The following code generates the error:
    create or replace PROCEDURE AMENDNUMBER_UPDATE
    (
    SHIP_NUMBER IN VARCHAR2,
    AMEND_NO ON SYS_REFCURSOR)
    AS
    BEGIN
    UPDATE CSPS_SHIPMENT_INFO_TL
    SET AMENDMENT_NO =
    (SELECT AMENDMENT_NO + 1
    OF CSPS_SHIPMENT_INFO_TL
    WHERE SHIPMENT_NUMBER = SHIP_NUMBER
    )
    WHERE SHIPMENT_NUMBER = SHIP_NUMBER;

    AMEND_NO OPEN FOR SELECT AMENDMENT_NO FROM CSPS_SHIPMENT_INFO_TL WHERE SHIPMENT_NUMBER = SHIP_NUMBER;

    -VALIDATION;
    END AMENDNUMBER_UPDATE;

    now when I try to run the under statement I get the above error:
    exec amendnumber_update (ship_number);


    Please suggest how to manage...

    Hello

    TCSBPMUSER wrote:
    Hi all
    Here is the error:
    ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments

    It's one of these error messages that actually means what he says.

    The following code generates the error:
    create or replace PROCEDURE AMENDNUMBER_UPDATE
    (
    SHIP_NUMBER IN VARCHAR2,
    AMEND_NO ON SYS_REFCURSOR)
    AS...

    now when I try to run the under statement I get the above error:
    exec amendnumber_update (ship_number);

    The procedure requires 2 arguments.
    You try to call with only 1 argument. It's the wrong number of arguments.

    To call the procedure from SQL * Plus, you can do something like this:

    VARIABLE   rc  REFCURSOR
    
    EXEC  amendnumber_update (123, :rc);
    

    The 1st argument is an argument IN, so you can pass any kind of digital expression. (I used a literal above.)
    The 2nd argument is an OUT argument, so you must pass a variable. (I used a variable link above.)

  • ORA-06550: line 1, column 34: PLS-00103 in Validation element with 4 APEX

    Hello
    I use 4 APEX?
    I created ths program to validate an element
    DECLARE
    LONGEUR1 NUMBER;
    BEGIN
    Select the LENGTH IN LONGEUR1 OF the BOOK WHERE code_ouvrage = (select code_ouvrage from the book where language =: P6_CODE_OUVRAGE);
    IF: P6_PK < 0 or: P6_PK > LONGEUR1 THEN
    RETURN FALSE;
    ON THE OTHER
    RETURN TRUE;
    END IF;
    END;

    I had thir error message when you run the page:
    ORA-06550: line 1, column 34: PLS-00103: symbol "DECLARE" met instead of one of the following symbols: () - + new case mod not null to other table avg current County exists max min prior sql stddev sum variance run the two main merger year forall multiset months DAY_ hour minute second stimezone_minute timezone_region timezone_abbr time end date interval timestamp timezone_hour

    ERR-1025 expression PLSQL treatment error. DECLARE LONGEUR1 NUMBER; START LENGTH Select INTO LONGEUR1 FROM BOOK WHERE code_ouvrage = (select code_ouvrage from the book where language =: P6_CODE_OUVRAGE); IF: P6_PK < 0 or: P6_PK > LONGEUR1 THEN RETURN FALSE; ELSE RETURN TRUE; END IF; END;


    All siggestion please?

    Rob wrote:
    Hello
    I use 4 APEX?
    I created ths program to validate an element
    DECLARE
    LONGEUR1 NUMBER;
    BEGIN
    Select the LENGTH IN LONGEUR1 OF the BOOK WHERE code_ouvrage = (select code_ouvrage from the book where language =: P6_CODE_OUVRAGE);
    IF: P6_PK < 0="" or="" :p6_pk=""> LONGEUR1 THEN
    RETURN FALSE;
    ON THE OTHER
    RETURN TRUE;
    END IF;
    END;

    I had thir error message when you run the page:
    ORA-06550: line 1, column 34: PLS-00103: symbol "DECLARE" met instead of one of the following symbols: () - + new case mod not null to other table avg current County exists max min prior sql stddev sum variance run the two main merger year forall multiset months DAY_ hour minute second stimezone_minute timezone_region timezone_abbr time end date interval timestamp timezone_hour

    ERR-1025 expression PLSQL treatment error. DECLARE LONGEUR1 NUMBER; START LENGTH Select INTO LONGEUR1 FROM BOOK WHERE code_ouvrage = (select code_ouvrage from the book where language =: P6_CODE_OUVRAGE); IF: P6_PK < 0="" or="" :p6_pk=""> LONGEUR1 THEN RETURN FALSE; ELSE RETURN TRUE; END IF; END;

    All siggestion please?

    What is the Validation Type? It seems you are trying to use the code for validation of Boolean function return in one of type PL/SQL Expression.

    Make sure that the Validation Type is function to return a Boolean.

  • Lines in columns

    Hello

    I'm currently stuck with a problem when trying to convert some lines in columns, but the solutions I've found don't quite give me the result I want.

    Here's an example of how the transactional system stores its information.
    TRANS_REF   TRANS_LINE  ITEM_CODE   SUPP_DESCR                      PURCH_QTY
    PPI-026166  1           TELE1       Teléfono Celular Bmobile QW101  7000
    PPI-026166  2           TELE1       Teléfono Celular Motorola Spic  300
    PPI-026166  3           -           e                               0
    PPI-026166  4           TELE1       Teléfono Celular Huawei 6150 3  3777.7777
    PPI-026166  5           -           G, color azul/negro, Manos lib  0
    PPI-026166  6           -           res, manual inglés/español, Mi  0
    PPI-026166  7           -           cro SD de 2GB. Version SW: U61  0
    PPI-026166  8           -           50CAMB100                       0
    As you can see the transaction system is not any kind of ID for each item and each spans several lines, but the desired report would need the description be concatenated into a single description, like that I should only be left with 3 rows. The "good" is to identify the start of an element by the "TELE1' ITEM_CODE and not knowing how many lines the description will take.

    Concerning

    Hello

    vacadude wrote:
    Thanks much for the tips on how to post!

    Well, I use Oracle 11g,

    There is no Oracle 11f or 11 o'clock, so it is a bit ridiculous to say that you are using 11g. Say something like 'I'm using Oracle 11.2.0.1.0'.

    and the results you've posted, that's exactly what I'm looking for. I guess it would be with the LISTAGG function but I can't quite grasp its use, could you help me a bit with her?

    Here's a way to get these results using the LISTAGG:

    WITH     got_grp_id     AS
    (
         SELECT     transactions.*
         ,     COUNT (CASE WHEN item_code = 'TELE1' THEN 1 END)
                  OVER ( PARTITION BY  trans_ref
                          ORDER BY        trans_line
                        )       AS grp_id
         FROM    transactions
    )
    SELECT       trans_ref
    ,       MIN (trans_line)          AS first_trans_line
    ,       LISTAGG (supp_descr) WITHIN GROUP (ORDER BY trans_line)
                                          AS supp_descr
    ,       MAX (purch_qty)          AS purch_qty
    FROM       got_grp_id
    GROUP BY  trans_ref
    ,            grp_id
    ORDER BY  trans_ref
    ,            grp_id
    ;
    

    LISTAGG guess the order of the concatenated elements is always important, so he always requres «...» In the BOSOM OF THE GROUP (SOMETHING)". This differs from the more common aggregate functions (including MIN and MAX), where the order of the entries lines dioesn can't issue, and there is nothing to sort on an output, so these functions have «...» In the BOSOM OF THE GROUP (SOMETHING)".
    (Besides, if, for some reason, you really want to exit in a random order, you would have to say something like)

    LISTAGG (supp_descr)  WITHIN GROUP (ORDER BY  0)
    

    ).

    You always need a subquery as got_grp_id, because you need to GROUP BY something like grp_id, being derived from an anlalytic function, and GROUP BY is done before the analytical functions are calculated.
    With LISTAGG, you do not need a subquery as got_r_num. Using CONNECT BY, something very ordinary (such as integers consectuive) was necessary to get the lines in the order. LISTAGG using, what can go in a cllause ORDER BY is good enough.

  • Turn the report - lines in columns

    Hope someone can help me with a script SQL that can transform a report from 90 degrees to the row data become columns

    for example

    Select month, cost, Discount
    of Customer_Table

    Month Cost Discount
    08 June to $ 34 to $6
    Jul 08 47 $ $3
    08 August to $ 87 to $8

    Should look like this

    Month June 08 Jul 08 Aug 08
    Cost $34 $ 47 $87
    Discount of $6 $3 $8

    Frank

    Number of columns in a SQL is static. You cannot add columns dynamically. If you want to then build you a SQL query dynamically and run it.

  • Matrix - vector lines and columns

    M1 (3,2) gives the element of line 3, column 2

    M1 (2) gives the second row of a matrix (as a vector line)

    Is there a way to return a column (other than transpose, store again and using the method above on the transposed matrix)?

    Tim Wessman wrote:

    Assuming that first here...

    Col(M1,1)

    Row(M1,1)

    @ Tim,.

    As Mmmm - created a post on the 39gii and commented on a post on the 39gii, this one is perhaps more likely to be on the 39gii?

    I think that your presumption re - expresses my presumption that the 39gii becomes brother forgot the premium?

    @ Mmmm.

    Try M1 (-c), where C is desired column number. For example M1(-2) for column 2.

  • P7-1298cb: Multi-color flickering lines in columns displayed on the screen after upgrade Windows 10.

    I upgraded Windows Windows 8.1 1O.  I've updated the drivers.  The monitor multicolored poster of fine lines in columns.  The lines of twinkle randomly.  The monitor is a diagonal LED of 2711 x 27 inch HP (XP600A) screen.  It is not that there is a specific monitor for Windows 10 driver.  Any suggestions on how to fix this?

    HI @TLL2016,

    Thanks for getting back to me.

    There is no update BIOS, but there is more recent graphics driver.

    Here is a link the download AMD UMA Graphics Driver.

    Just to check the monitor, here is a document for display quality problems.

    Please keep me informed of the progress of things.

    If you need help, let me know and I will gladly make all that I can to help you.

    Please let me know if that solves the problem by marking this post as "accept as a Solution.
    To simply say thank you, click the Thumbs up below!

    Thank you.

Maybe you are looking for