Collection of varchar conversion - PLSQL

Oracle 11 g.

Problem statement:

I'll get a list of values (list varchar2) as input for a procedure, and I need to make use of each value in my select statement within the procedure described in the WHERE clause.

CREATE TABLE employees

(employee_number number (10),)

Employee_Name varchar2 (50)

);

insert into employees values (1, 'JOHN');

insert into employees values (2, 'MIKE');

CREATE OR REPLACE TYPE 'VARCHAR_TBL' STRENGTH AS TABLE OF THE VARCHAR2 (1024);

P_string (p_list_of_value VARCHAR_TBL procedure

p_out SYS_REFCURSOR)

IS

BEGIN

OPEN for P_out

Select * from employee where employee_name IN (< string Input >);

END;

-test script-

declare

p_list_of_value varchar_tbl;

Start

-Call the procedure

p_list_of_value: = NEW varchar_tbl();

p_list_of_value.extend ();

p_list_of_value (1): = 'JOHN ';

p_list_of_value.extend ();

p_list_of_value (2): = ('MIKE');

p_string (p_list_of_value = > p_list_of_value,)

p_out = >: p_out);

end;

Now the result of the p_string procedure must be lsiting both records.

I used only two records as input for the statement of the problem, but it will be varry from 1 to several...

What are the best way to achieve this. Thank you..

Just ask the collection as if it were a table:

Select * from employee where employee_name IN (SELECT VALUE FROM TABLE (p_list_of_value));

Try this code example:

-type to match record emp

create or replace type emp_scalar_type as an object

(EMPNO NUMBER 4,

ENAME VARCHAR2 (10),

USE VARCHAR2 (9).

MGR NUMBER 4,

HIREDATE DATE,

NUMBER OF SAL (7, 2)

NUMBER OF COMM (7, 2)

DEPTNO NUMBER (2)

)

/

-records of the emp table

create or replace type emp_table_type to table of emp_scalar_type

/

declare

TB emp_table_type;

sys deptnoList. OdciNumberList;

BEGIN

Select emp_scalar_type (empno, ename, job, mgr, hiredate, sal, comm, deptno)

bulk collect into tb emp;

Collect SELECT deptno in bulk

IN deptnoList

DEPARTMENT where deptno not in (select deptno table (tb));

I'm looping 1.deptnoList.count

dbms_output.put_Line (deptnoList (i));

end loop;

END;

Tags: Database

Similar Questions

  • Long Varchar conversion?

    OK, so I'm trying to analyze the source code of compiled views. so I'm going with a simple:

    long value 1000000

    Select the text in dba_views where view_name = "DBA_VIEWS;

    I use DBA_VIEWS just to keep the results to short, because everyone has it... and it's mildly amusing to choose from to

    In reality, I will have a wider where clause.

    So, now I want to search the text for some references, diagrams and tables. So let's just look at "sys."

    Select text

    from dba_views

    where view_name = "DBA_VIEWS.

    and instr (text, 'sys') > 0;

    ERROR on line 4:

    ORA-00932: inconsistent data types: expected NUMBER got LONG

    Large.

    OK, so I'm doing a research to try to understand to get 'convert' a long varchar and each solution according to me, is to 'migration' of the data. In other words, it assumes that you have created your own TABLE with a LONG data type, and the need to MOVE in another TABLE. Which is not even close to what I'm doing here. I question the fair data.

    Then I come across this little gem:

    http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:839298816582

    Candy!

    So I give that a try:

    (I've renamed its function, but has not changed any other logic, or another change of name).

    FUNCTION to CREATE or REPLACE f_long_to_varchar

    (p_tname IN VARCHAR2,

    p_cname IN VARCHAR2,

    p_rowid IN ROWID

    )

    RETURN VARCHAR2

    AS

    l_cursor INTEGER default dbms_sql.open_cursor;

    l_n NUMBER;

    l_long_val VARCHAR2 (4000);

    l_long_len NUMBER;

    l_buflen NUMBER: = 4000;

    l_curpos NUMBER: = 0;

    BEGIN

    DBMS_SQL. Parse (l_cursor,

    "SELECT" | p_cname | 'FROM ' | p_tname |

    ' WHERE rowid =: x',.

    DBMS_SQL.native);

    DBMS_SQL.bind_variable (l_cursor, ': x', p_rowid);

    DBMS_SQL.define_column_long (l_cursor, 1);

    l_n: = dbms_sql.execute (l_cursor);

    IF (dbms_sql.fetch_rows (l_cursor) > 0) THEN

    DBMS_SQL.column_value_long (l_cursor, 1, l_buflen, l_curpos,)

    (l_long_val, l_long_len);

    END IF;

    DBMS_SQL.close_cursor (dbms_sql.open_cursor);

    RETURN l_long_val;

    END f_long_to_varchar;

    /

    Select f_long_to_varchar (text) in the dba_views where view_name = "DBA_VIEWS;

    ERROR on line 1:

    ORA-00997: illegal use of the LONG data type

    Large. So, does anyone have other ideas?

    How can I query the dba_views and sweep the text as a varchar field?

    Can it be done without moving the data to a temp table? Or the other case - how to do?

    I'm coming up absolutely empty on that.

    Thank you!

    Without creating additional objects, you can try the following query. It supports the content of greater than 32 KB size.

    However, it is quite slow.

    Select v.owner

    v.view_name

    x.text

    from dba_views v

    , xmltable ('/ LINES/LINES/VIEW_T ')

    passage (document xmlparse

    () DBMS_METADATA.get_XML

    schema-online v.owner

    , object_type-online "VIEW".

    name-online v.view_name

    )

    correct

    )

    path of clob columns text "TEXT".

    ) x

    where instr (x.text, 'QA') > 0

    - and v.view_name = 'DBA_STREAMS_COLUMNS. '

    ;

  • implicit conversion to sql

    Hi guys,.

    I have a question on how the oracle is posting implicit conversion in the following cases.

    I have a table: table1 with two columns: a number (10), b varchar2 (10). Both are indexed unique.


    If I have a SQL like this:
    select * from table1 where a = '99'
    the implicit conversion is performed on '99' and the final SQL will be something like:
    select * from table1 where a = to_number ('99')
    the same thing will happen with 'aaa' and I get an error. Please note that represents the column and the index will be used.

    If I have a sql like:
    select * from table1 where b = 99
    Note that b is the varchar2 column.
    the implicit conversion will be done on the column and the index will not be used
    select * from table1 where to_number (b) = 99
    THEN, forgetting for a moment that it is not OK to allow an implicit conversion, what are the rules that apply here? If the number, the conversion will be made on the value and varchar conversion will be performed on the column? What else?


    Thank you

    http://docs.Oracle.com/CD/E11882_01/server.112/e26088/sql_elements002.htm#SQLRF51047

  • using indexes on varchar confusion with pl/sql collections

    Hi, I seek to learn the mechanics behind the collections and have done ok so far until I came across you try using the index of varchar.

    I use the following code: -.
    declare
      type address_lines_tab is table of varchar2(50)
        index by pls_integer;
    
      type address_tab is table of address_lines_tab
        index by varchar(40);
    
      type student_rec is record(
        first     varchar2(40),
        last      varchar2(40),
        address   address_tab
      );
    
      type student_tab is table of student_rec
        index by pls_integer;
    
      student   student_tab;
      i         number       := 0;
      v         varchar2(20);
      x         number       := 0;
    begin
      student(1).first := 'mike';
      student(1).last := 'jones';
      student(1).address('home')(1) := 'the manor';
      student(1).address('home')(2) := 'london';
      student(1).address('home')(3) := 'w12 4kf';
      student(1).address('term')(1) := '5 university';
      student(1).address('term')(2) := 'plymouth';
      student(1).address('term')(3) := 'pl22da';
      student(2).first := 'helen';
      student(2).last := 'roots';
      student(2).address('home')(1) := '1 little lane';
      student(2).address('home')(2) := 'hull';
      student(2).address('home')(3) := 'h45 4fd';
      student(2).address('term')(1) := '3 university';
      student(2).address('term')(2) := 'plymouth';
      student(2).address('term')(3) := 'pl22da';
    
      for student_no in student.first .. student.last
      loop
        dbms_output.put_line(   'STUDNET NAME:'
                             || student(student_no).first
                             || ' '
                             || student(student_no).last);
    
        for add_type in
          student(student_no).address.first .. student(student_no).address.last
        loop
          dbms_output.put_line(student(student_no).address);
          for add_line in
            student(student_no).address(add_type).first .. student(student_no).address(add_type).last
          loop
            dbms_output.put_line(student(student_no).address(add_type)(add_line));
          end loop;
        end loop;
      end loop;
    end;
    the problem I have is in the second loop when trying to display 2 different types of address (IE home and term).

    because its indexed by a varchar, I get the following error: -.
    ORA-06502: PL/SQL: digital or value error: character of number conversion error

    How can I get around that, when a loop in the associative arrays that are indexed by varchar?

    Thank you very much

    It's the exit, I expect to see:-
    STUDNET NAME:mike jones
    HOME
    the manor
    london
    w12 4kf
    TERM
    5 university
    plymouth
    pl22da
    STUDNET NAME:helen roots
    HOME
    1 little lane
    hull
    h45 4fd
    TERM
    3 university
    plymouth
    pl22da

    Hello..

    The problem is tat you can not use a "student (student_no).address.first" and "student (student_no).address.last" in a loop; because they are varchar2 index...

    Yo can use, something like that...

        nuStudent := student(student_no).address.count;
        for add_type in 1 ..nuStudent 
    
  • PLSQL Collection for the holding of the identifiers

    Hello experts,

    I ask for your help?

    I have tables like this: COMP_REL (PARENT NUMBER, NUMBER of CHILDREN) and COMP_INFO (NUMBER CHILD,...).

    In a procedure, I need to make several select statements of COMP_INFO for all children under a parent (grouping of different columns of COMP_INFO).

    The problem is that COMP_REL table is huge. How can I use PLSQL collection (or table) to store the children of COMP_REL I need and then join this collection with COMP_INFO to get different data?

    It is advisable to use collections PLSQL for this purpose at all?


    Thank you, Atanas.

    Hello

    I used analytical functions for the info that I need with only a query the comp_info table (didn't need to interrogate several times). So I didn't have to use TWG or a collection of temporary cache results.

    Thank you very much for your help!

  • Why Table function is not allowed on the collections defined in PLSQL?

    We all know that we can use the function table on collections defined as database object type. Why cant Oracle provide this function for defined collections in PLSQL?

    For prior 12c version you can play around with pipelined functions.
    
    SQL> create or replace package emppkg
      2  as
      3    type rec is record (empno integer, ename varchar2(100));
      4    type tbl is table of rec;
      5
      6    function get (pdeptno in integer) return tbl pipelined;
      7  end;
      8  /
    
    Package created.
    
    SQL> show err
    No errors.
    SQL> create or replace package body emppkg
      2  as
      3    function get (pdeptno in integer) return tbl pipelined
      4    is
      5       lrec rec;
      6    begin
      7       for i in (select empno, ename from emp where deptno = pdeptno)
      8       loop
      9          lrec.empno := i.empno;
     10          lrec.ename := i.ename;
     11          pipe row(lrec);
     12       end loop;
     13
     14       return;
     15    end;
     16  end;
     17  /
    
    Package body created.
    
    SQL> show err
    No errors.
    SQL> select * from table(emppkg.get(10));
    
         EMPNO ENAME
    ---------- --------------------
          7782 CLARK
          7839 KING
    
    SQL> select * from table(emppkg.get(20));
    
         EMPNO ENAME
    ---------- --------------------
          7369 SMITH
          7566 JONES
          7788 SCOTT
          7876 ADAMS
    
    SQL> select * from table(emppkg.get(30));
    
         EMPNO ENAME
    ---------- --------------------
          7499 ALLEN
          7521 WARD
          7654 MARTIN
          7698 BLAKE
          7844 TURNER
    
    SQL>
    
  • Hi, I have a question, I m interested in buying cc for oligo, but I didn't how will look at payment collected monthly from my account. I m from Poland, is if there is any conversion related to the collection to the monthly fee? Exceeds one

    Hi, I have a question, I m interested in buying cc for oligo, but I didn't how will look at payment collected monthly from my account. I m from Poland, is if there is any conversion related to the collection to the monthly fee? Is beyond the $ 19.99 euros will be ordered to pay the money transfer from zlotys to the euro.

    Hello

    In order to know the payment process, you can contact Adobe support:

    https://helpx.Adobe.com/contact.html?step=CCSN

    To know the offers and different plans, you can visit the Adobe Web site:

    Pricing plans and creative Cloud membership | Adobe Creative Cloud

    Let us know if you need more information.

  • Select the data from collections plsql

    Hi all

    I'm not a developer but working as a DBA, so not very familiar with pl/sql, always crossed with documentation and could lead to a solution of my problem. I need advice from expert here.

    Problem: I am writing in a kind of special program plsql for surveillance of certain lots, I know that we have much option to do the same db/grid control including... etc but for some
    the reason I have to do this, use only plsql.

    Requirement: my requirement is to select data in the plsql table and then have the opportunity to ask questions again and again. I prefer not to go to table, rather than directly from plsql...

    I wrote below the code for the sample, bulk data in collection type collection and can print using the loop.

    Declare
    TS type is table v$ session % rowtype index by pls_integer;
    tsess ts.
    Start
    Select * bulk collect into tsess from v$ session;
    I'm looping 1.tsess.count
    dbms_output.put_line (tsess (i) .terminal);
    end loop;
    end;
    /

    But is it possible same collection (tsess in the example above) can be queried using a select as ' select * from table (Tsess) "I searched the net and found this can be done using create type at the database level.ยป But my problem is that I can't create any object in the database as being it's a production one.

    I was looking as if is it possible even can be accomplished... as cast / multiset... However, I could not get it through.

    your help would be appreciated!

    Kind regards

    I don't think you should use the tables here, only SQL, take a look at the factors of subquery and will indicate if it is not enough...

    Published by: BrendanP on February 12, 2012 03:07 for an example:

    I understand you want to "Refresh" of data that you already have the database purely to be able to use the SQL such as ORDER BY in multiple ways. Here's how you can do it in the original SQL for a particular example, where you query v$ sql time control processor and disk reads separately (I tested it but the result won't be good look here, so omitting it):

    WITH v AS (
    SELECT
        Substr (sql_text,1,500)             sql_text,
        cpu_time/1000000                    cpu_seconds,
        disk_reads,
        buffer_gets,
        executions,
        CASE WHEN rows_processed != 0 THEN Round( buffer_gets / Nvl (Replace (rows_processed, 0, 1) ,1)) END Buffer_gets_rows_proc,
        Round (buffer_gets / Nvl (Replace (executions, 0, 1), 1)) Buffer_gets_executions,
        elapsed_time / 1000000              elapsed_second,
        module
    FROM v$sql s)
    SELECT
        'CPU'                order_by,
        cpu_seconds          order_val,
        sql_text,
        cpu_seconds,
        disk_reads,
        buffer_gets,
        executions,
        buffer_gets_rows_proc,
        buffer_gets_executions,
        elapsed_second,
        module
    FROM v
     UNION
    SELECT
        'Disk reads',
        disk_reads,
        sql_text,
        cpu_seconds,
        disk_reads,
        buffer_gets,
        executions,
        buffer_gets_rows_proc,
        buffer_gets_executions,
        elapsed_second,
        module
    FROM v
    ORDER BY order_by, order_val DESC
    
  • Type of collection in PLSQL and Oracle

    Hi all

    I define a collection type in Oracle. When I try to use it in following PLSQL, I "PLSQL-00405: subquery not allowed in this context" error. How can I use the values that I have previously defined in the collection for this case?

    Thank you

    Mike



    CREATE or REPLACE the TYPE testCaseSet IS TABLE OF NUMBER;
    \




    CREATE OR REPLACE PACKAGE PK_test
    testCaseSet C_TEST_CASE: = testCaseSet (1,3,5,7,9);

    PROCEDURE showTestCase()
    IS
    BEGIN
    IF rec_testForm.testNbr IN
    (SELECT * from TABLE (C_TEST_CASE))
    THEN
    ...
    END IF;

    END showTestCase
    END PK_test

    It seems that the loop will be entered regradless of the value of v_tes_case_nbr

    And what is v_tes_case_nbr? A variable defined somewhere? In this case, try

    ...
    FOR c in (SELECT *FROM TABLE(C_Test_Set) WHERE TestText = 'Regression Test' AND TestNbr  = v_test_case_nbr AND ROWNUM = 1)
    LOOP
    .....
    END LOOP;
    ...
    
  • PLSQL collection

    Hi all

    I would like to use collect (or table) in order to maintain some predefined values, which can be used later in the PLSQL. Here's what I have: ORA-00932: inconsistent data types: NUMBER expected...

    Any idea?

    Thanks in advance,

    Mike


    Create table testCase
    (
    caseNbr NUMBER (5);
    caseTxt VARCHAR2 (10);
    );


    TestMap ARRAY TYPE IS NUMBER;
    testMap v_map: = testMap (1,3,5,7);

    SELECT *.
    OF testCase
    WHERE caseNbr IN (v_map);

    Edited by: user550903 29-Sep-2011 11:10

    Still, you can use the local collection type (type declared in a PL/SQL). You must declare it in SQL. Then use:

    WHERE tesNbr in (select * from table(v_testMap));
    

    SY.

  • Can we do a query returns a collection plsql?

    Im trying to develop a function that returns a table nested records to a sql query, but I get
    ORA-00932: inconsistent data types: expected - was -.
    ORA-06512: at "CDB_WEB. PIPE_RESULTS', line 38

    The original version of this function (which works) is a function in the pipeline is no longer usable we hit a bug with functions in pipeline oracle in our production server and need to try a workaround...

    It's what I've done:

    1. create the type of record and the nested in the schema table:

    Create the OBJECT IS of TXR_RECORD type
    (external_id VARCHAR2 (25),)
    source tank (3),
    info1 VARCHAR2 (4000).
    info2 VARCHAR2 (4000).
    Info3 VARCHAR2 (4000).
    info4 VARCHAR2 (4000));
    /
    CREATE the type txr_table IS TABLE OF THE txr_record;
    /

    2 update plsql function to populate the nested table:

    FUNCTION to CREATE or REPLACE pipe_results (p_external_id VARCHAR2,
    p_source VARCHAR2,
    P_FROM INTEGER,
    p_to INTEGER)
    RETURN txr_table
    IS

    l_txr txr_table: = txr_table();
    rettab txr_table: = txr_table();
    l_from INTEGER: = 0;
    l_to INTEGER: = 5;
    sqlstr varchar2 (4000): = NULL;


    TYPE cv_type IS REF CURSOR;
    CV1 cv_type;

    BEGIN

    sqlstr: = ' SELECT external_id, source, info1, info2, info3, info4
    OF xrefs_sptr
    WHERE source =: x (this reads: x without the gap in the code, but it appears as a smily face if I repeat here)
    AND external_id =: y
    ORDER BY info4';


    Cv1 OPEN for sqlstr HELP p_source, p_external_id;
    Cv1 FETCH BULK COLLECT INTO l_txr;
    Cv1 CLOSE;

    l_from: = p_from;
    l_to: = p_to;

    I'm IN p_from... p_to
    LOOP
    IF l_txr (i) IS NOT NULL
    THEN
    rettab.extend;
    rettab (i): = l_txr (i);
    END IF;
    END LOOP;

    return rettab;
    END;
    /


    3. so far, everything seems ok, but when I try and call it since sql:

    Select the source, info1, info2, info3, external_id, info4
    table (pipe_results ('PMC1687509', 'PMC', 1, 5));

    I get the error:

    table (pipe_results ('PMC1687509', 'PMC', 1, 5))
    *
    ERROR on line 2:
    ORA-00932: inconsistent data types: expected - was -.
    ORA-06512: at "CDB_WEB. PIPE_RESULTS', line 38


    Im sure Im overlooking something basic despite re-reading the documentation and plsql programming Im a bit confused... is it possible to do what I try without using a pipeline function?

    I agree with all your points and suggestions, and of course, this isn't a function in pipeline.

    But, as stated in the original post:

    user4208249 wrote:
    The original version of this function (which works) is a function in the pipeline is no longer can be used as we hit an oracle bug with pipeline functions in our
    production server and the need to try a workaround ...

    Of course, it would be preferable if this "Workaround" could use straight SQL and PL/SQL. So, we need a clarification of the o.p.: how to use the current pipeline function?

  • Collections of Oracle PLSQL

    Hello

    I have a java application which all stored procedure. One of the entrances to the java procedure would be some IDs that are dynamic. The id number is dynamic. So, how can u handle this dynamic multiple oracle java entries. Can I see from the collections to come?

    Thanks in advance

    [How to return an array of strings of a Java stored procedure | https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=726937.1]
    [How to move the table data type Java String to PL/SQL Stored Procedures | https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=147361.1]
    [How to return an array of records of a Java stored procedure? | https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=727813.1]
    [How to pass the array of Java in Pl/Sql as a Varray | https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=444189.1]

    SY.

  • help the PLSQL Collections

    Table of database products and category of two columns.

    Table: catalogue
    products in category
    ----------- ------------
    Fruits Apple
    vegetables carrots
    Pepsi soda
    vegetables potatoes
    fruit grapes
    Orange fruit
    cabbage vegetable
    soda Coke

    I need to read the records in the catalog of the table and store it in a sort of collection plsql. I then read this collection and write the output as follows:

    Note: the categories and products must be sorted alphabetically in the output.

    OUTPUT
    ------------

    fruit, Apple, grape, orange
    soda Coke, pepsi
    vegetable cabbage, carrots, potatoes

    Please help me because the way in which this can be done?

    Thank you
    G
    SQL> CREATE OR REPLACE
      2    TYPE PRODUCT_TBL IS TABLE OF VARCHAR2(20);
      3  /
    
    Type created.
    
    SQL> CREATE OR REPLACE
      2    TYPE CATALOG_OBJ IS OBJECT(
      3                               category     VARCHAR2(20),
      4                               product_list PRODUCT_TBL
      5                              );
      6  /
    
    Type created.
    
    SQL> CREATE OR REPLACE
      2    TYPE CATALOG IS TABLE OF CATALOG_OBJ;
      3  /
    
    Type created.
    
    SQL> SET SERVEROUTPUT ON
    SQL> DECLARE
      2      v_catalog CATALOG;
      3      v_line    VARCHAR2(100);
      4  BEGIN
      5      WITH t AS (
      6                 SELECT 'fruit' category,'apple' product FROM dual UNION ALL
      7                 SELECT 'vegetable','carrot' FROM dual UNION ALL
      8                 SELECT 'soda','pepsi' FROM dual UNION ALL
      9                 SELECT 'vegetable','potato' FROM dual UNION ALL
     10                 SELECT 'fruit','grapes' FROM dual UNION ALL
     11                 SELECT 'fruit','orange' FROM dual UNION ALL
     12                 SELECT 'vegetable','cabbage' FROM dual UNION ALL
     13                 SELECT 'soda','coke' FROM dual
     14                )
     15      SELECT  CATALOG_OBJ(
     16                          category,
     17                          CAST(COLLECT(product) AS PRODUCT_TBL)
     18                         )
     19        BULK  COLLECT INTO v_catalog
     20        FROM  t
     21        GROUP BY category
     22        ORDER BY category;
     23      FOR i IN 1..NVL(v_catalog.count,0) LOOP
     24        v_line := rpad(v_catalog(i).category,10);
     25        FOR j IN 1..v_catalog(i).product_list.count loop
     26          v_line := v_line || v_catalog(i).product_list(j) || ', ';
     27        END LOOP;
     28        v_line := RTRIM(v_line,', ');
     29        DBMS_OUTPUT.PUT_LINE(v_line);
     30      END LOOP;
     31  END;
     32  /
    fruit     apple, grapes, orange
    soda      pepsi, coke
    vegetable carrot, potato, cabbage
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    SY.

  • I don't want spam to be collected in conversations, I always want to see all the emails sorted by date

    Whenever I answered an email, emails with the same subject are grouped into conversations. To search for a specific post, it's too easy to forget the mail that it could be hidden in a conversation. Can I get rid of chat and just look at all the emails they get?

    The menu bar, select View-sort by Unthreaded

    No bar menu with view? Press the alt key to make it appear.

  • conversion of a delimited list of a collection

    Hello
    
    Version 11g r2
    create or replace type jobcheck_type  as object   ( 
    jid VARCHAR2(250),
    jname VARCHAR2(250),
    jtot_mesgs NUMBER,
    jsuccess NUMBER,
    jfailure NUMBER,
    jstart_time TIMESTAMP,
    jcompleted_time  TIMESTAMP,
    jstatus VARCHAR2(50),
    jversion NUMBER
     )
    /
    
    
    create or replace type jobchecktab_type  as table of jobcheck_type
    /
    Now   
    select * from table(jobchecktab_type(jobcheck_type(null,'A,B',30,30,0,null,null,null,null)));
    
    The output is 
    
    null A,B 30 30 0 null null ...
    
    But what I need is
    
    null A 30 30 0 null null
    
    null B 30 30 0 null null
    
    if 
    select * from table(jobchecktab_type(jobcheck_type(null,'A,B,C,D',30,30,0,null,null,null,null)));
    Then output required is 
    
    But what I need is
    
    null A 30 30 0 null null
    
    null B 30 30 0 null null
    
    null C 30 30 0 null null
    
    null D 30 30 0 null null
    
    I'm passing the comma separated values one of the value(jname) in collection and rest other values in collection are constant.
    
    From some reason, I would be needing that to be done in select statement  only i.e select * from table(jobchecktab_type .....
    
    
    

    No problem here:

    Select the IADB

    regexp_substr (jname, ' [^,] +', 1, level) jname,.

    jtot_mesgs,

    jsuccess,

    jfailure,

    jstart_time,

    jcompleted_time,

    jstatus,

    jversion

    from (select *)

    table (jobchecktab_type (jobcheck_type (null, 'A XXXX_YYY, AAAA X, Sweep NEM', 30, 30, 0, null, null, null, null)))

    connect by level<= length(regexp_replace(jname,="" '[^,]+',="" ''))="" +="">

Maybe you are looking for