Table nested @ schema - level how to extract the first clue?

Hello

My version of oracle database: 11g

I present to you the code here and here are the steps by which I created a table and theres a regular column to the number, but the 2nd column is a nested table.

(1) create or replace type s_def_NT_DepEmployees is table of the varchar2 (100);

2)

create the table employees_NT_test

(number of department_id

c_of_s_def_NT_DepEmployees s_def_NT_DepEmployees)

nested as NTs_c_of_s_def_NT_DepEmployees table c_of_s_def_NT_DepEmployees store

(3) now, I inserted 2 records:

insert into employees_NT_test values (1, s_def_NT_DepEmployees ('Rahul', 'Myra'));

insert into employees_NT_test values (2, s_def_NT_DepEmployees ('Rashi', 'Gaurav'));

(4) now get me this sql allows employees of department_id: 1

Select column_value

table (select c_of_s_def_NT_DepEmployees in the employees_NT_test where department_id = 1);

Output:

Rahul

Myra

Now my question: I want to just choose the first clue: IE: rahul (and not myra) and it should be compatible such that if I select the two departments I should get my output like:

Department_id | employees

1                    | Rahul

2                    | Rashi

PS: I am looking for a sql query, I hope I presented my question clearly, if there are doubts please let me know.

Thanks in advance

Rahul

Now my question: I want to just choose the first clue: IE: rahul(and not myra) and should be consistent

You can only do in a deterministic manner, given the current design.

Unlike PL/SQL, SQL has no way to access the items in the collection of their indices.

We can think about using ROWNUM (or ROW_NUMBER) in a subquery, but the SCOREBOARD operator and later join operations do not guarantee that the order will remain the same in the different calls.

You must redefine the collection 's_def_NT_DepEmployees' as an array of objects, and this object would include an index attribute explicitly on which you can filter.

The alternative is to create a function that takes the collection and the index for the arguments and returns the element at index - but even in this case I'm not sure that oracle could rebuild deterministically collection either.

Why use a table nested at all?

Tags: Database

Similar Questions

  • How to extract the first day of the year quarter

    Hello

    How can I write a query to extract the first day in a neighborhood of declaration

    for example: -.

    Q1 starts from April 1 to June 30, second quarter starts from July 1 to September 30, third quarter starts from 1 October to 31 December and the fourth quarter begins from January 1 to March 31.

    How can I recover then the first day of these quarters, regardless of the year. The year can be any year.

    Hello

    don't know exactly what you want, but if you want the first day of a quarter for any given date and then

    select trunc(sysdate,'Q') from dual;
    

    Sysdate obviously could be a valid date.

    André

  • How to: Extract the first three characters of a text field

    Greetings-

    What is the best method to extract the first three letters of a text field?

    I need to extract the first three letters of a text field (surname in this case),
    so I add other components to create an identification number for
    a person.

    This identification number which must be created consists of the
    date of the person by birth, last 4 digits of social security number and
    the first three letters of the person's first name.

    Example:
    == > Date of birth: 15/11/45
    == > Last 4 SSN: 6654
    == > Name: Smith

    Identification number would be:
    == > 1115456654SMI

    Leonard B


    That should do the trick:

    I put your values in the variable, simply replace the names, according to the needs


    This removes all the string of the / your birthday (if it's a string!) and puts it in the variable id:

    It takes the 4 last letters/digits of your social security number string and adds it to the id:

    It takes the first thre letters/numbers from your last name variable, capitalizes and adds to the identification string

    It will be useful.

  • How to extract the signal from the waveform of my power level designated?

    Hi all

    How can I extract the signal of the waveform accroding to the power level? I read the Trigger & Gate .vi, but this vi retrieves the signal duration. I want to extract the signal depending on the power level.

    As shown in the following figures, the signal I want to deal with is between 130000 to 140000, if I Zoom, I can see the useful signal is between 135400 to 138200. The question is how to extract the signal in the area?

    I tried the sub_NoiseEst_And_Chop_Shell.vi in the example of Packet_based_link also, but this Subvi seems to be a bit slow. Can someone give me the best advice? Thanks in advance!

    I'm working on something similar, but have not had time to fully develop.

    My idea was to use an envelope detector (low pass filter) and then use a detection of energy VI on the envelope.

    Here is where I left

  • How to extract the values of XMLTYPE column,

    SQL > create table temporary global xmtype_tab (xmlfile xmltype);

    SQL > select * from all_directories;

    SYS RESTOREDIR/home / / dbimptask /.

    insert into xmtype_tab values (xmltype (dbms_xslprocessor.read2clob ('RESTOREDIR ','LAS_SETUP.xml ')));

    1 line of creation.

    SQL > select * from xmtype_tab;

    XMLFILE
    --------------------------------------------------------------------------------
    <? XML version = "1.0"? >
    rowset <>
    < ROW >
    < DATA_CAPTURE_ON > 1 < / DATA_CAPTURE_ON >


    How to extract the values inside each tag?


    XML file has the following data...


    rowset <>
    < ROW >
    < DATA_CAPTURE_ON > 1 < / DATA_CAPTURE_ON >
    < > 9600 BAUD_RATE < / BAUD_RATE >
    < ACK_TIMEOUT > 1 < / ACK_TIMEOUT >
    < TUBE_TRAVEL_LIMIT > 4 < / TUBE_TRAVEL_LIMIT >
    < SEND_SID_TIMEOUT > 1 < / SEND_SID_TIMEOUT >
    < INDEX_Q_TIMEOUT > 2 < / INDEX_Q_TIMEOUT >
    < HW_HANDSHAKING > 1 < / HW_HANDSHAKING >
    < / ROW >
    < / LINES > ';

    I use the Oracle 10.2.0.3 version...

    Why does this work?

    You are missing the tag of the ROWSET:

    select extractvalue (xmlfile, '/ROWSET/ROW/BAUD_RATE') baud_rate
      from xmltype_tab
     where existsnode (xmlfile, '/ROWSET/ROW/BAUD_RATE') = 1;
    
  • Need urgent help! In my Vision Application, how to extract the parameters of the geometric model specified curve was generated by the template editor OR?

    I have an application of machine vision, in which the geometric pattern match technique was used to find the target in the images of type variant.

    as we know, we do a geometric model by model OR editor in the editor we can adjust the parameters of the curve specified settings to get the desired curves and we derive the custom box to ignore during the match. then we save the use of the same model in our application of vision.

    Now my question is coming. When I program my request for the geometric game. I have specified the parameters of the curve for the entrance of the IMAQ Advanced Setup learn ringtone 2, of course, I have to adjust this identical to the model, but I don't know how we extract the geometric model. I tried all the methods, for example, I can read data custom, IMAQ get characteristics of the geometric model(it's just for the basic functionality? so is there even a VI based edge?), even at anasys PNG file formats! But I can't read the info of the geometric model by myself!

    It is also illogical to adjust the CURVE SETTINGS manually again for the " IMAQ Advanced Setup Learn Pattern 2" after that I already have in the template editor OR!

    Hello

    Why do you need to specify the curve settings once again, if you have already built a model using the template editor? You don't need to use "IMAQ Advanced Setup learn geometric model 2 VI" to find games (see the attached example).

    You can wire the 'curve settings' control to 'IMAQ configuration geometrical game model 2 VI', but the values are not used if wire you a Boolean true to the node "use learning curve settings" (it's like that by default). To prove it, I enclose a small program with pre-created model (using the template editor) for a geometrical alignment. The model and the test of three images are also included.

    Try changing the settings of the curve with the 'use know curve settings' enabled, and you will see the corresponding score remains the same. Disable the Boolean control, then try to change the curve settings.

    Also take a look at the detailed help for "IMAQ configuration geometrical game model 2 VI", specifically the "learning curve parameters of use."

    I hope this helps.

    Best regards

    K

  • I downloaded a free trial of Adobe Creative cloud and dreamweaver CC. I am not able to download a .psd to see how to extract the HTML and CSS.

    I downloaded a free trial of Adobe Creative cloud and dreamweaver CC. I am not able to download a .psd to see how to extract the HTML and CSS.

    Download button is disabled. What is the case for a free trial?

    Hey girijamg,

    I asked that you try to open a page because snippet Panel will be disabled until there is a html page is open in DW.

    Excerpt from Panel will be ready for the job that after any html page is open in DW.

    Hope it makes sense.

    Lalita

  • Columns of folder: by default, how can return the first column 'Name' without having to move it manually every time?

    Something's happened awhile and when I create a folder which appears the first column is the column 'Date modified '. By default, how can return the first column 'Name' without having to move it manually every time?

    Hello

    I suggest you to visit these links and check if it helps:

    http://Windows.Microsoft.com/en-us/Windows-Vista/working-with-files-and-folders#section_4

    http://Windows.Microsoft.com/en-us/Windows-Vista/folders-frequently-asked-questions

    It will be useful.

  • How to set the first character as selections in the EditField.

    Hi friends,

    I am a third-party application that I have to set the first character as capital.

    so please help me how to set the first tank as capital.

    Take a look at AutoTextEditField - maybe you can use this to do it automatically...

  • How to find the first Sunday and the second Saturday of each month

    Hi all

    How to find the first Sunday and the second Saturday of each month

    Thank you

    Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production

    994122 wrote:

    Hello

    I need to pass the months parameter how to do this? like Jan, Feb etc... (one of those)

    Do you have a procedure?

    Should you output only for the months you passed in the parameter?

    The easiest way is to set the parameter as date. When you go such as p_date as DATE ' 2014-10-01', then you can

    PROCEDURE two_dates)

    p_date IN DATE

    p_first_sunday DATE

    p_second_saturday DATE

    )

    IS

    BEGIN

    p_first_sunday: = NEXT_DAY (TRUNC (p_date, 'MM') - 1, TO_CHAR (DATE ' 2014-10-12', 'DAY'));

    p_second_saturday: = NEXT_DAY (TRUNC (p_date, 'MM') - 1, TO_CHAR (DATE ' 2014-10-11', 'DAY')) + 7;

    END two_dates;

    Or you describe what you need.

  • How to put the first page to run?

    How to put the first page to run?

    Dimitri Gielis Blog (Oracle Application Express - APEX): Change the page (first) by default in APEX

  • Extract the first letter of each word

    Hi all

    I have a requirement to extract the first letter of each word as shown in the example below
    input: abcd output: a
    input: abcd efgh output: ae
    input: abcd efgh ijkl output: aej
    any help will be much appreciated

    I'm on the 11g version of the db

    Depends on your definition of a "word", but for example:

    SQL> select trim(regexp_replace(' a abcd efgh ijkl','(\S)\S*\s*','\1'))
      2  from dual
      3  ;
    
    TRIM(REGEXP_REPLACE('AABCDEFGH
    ------------------------------
    aaei
     
    
  • Extract the first and the last Date of the previous month

    This seems to be a delicate but again it is perhaps easy for some of you people.

    Here is how I find the previous month

    Any ideas on how to get the first and last date of the previous month?

    Thanks in advance.

    Hello!

    SQL>
    SQL> select last_day(add_months(sysdate,-1)) from dual;
    
    LAST_DAY
    --------
    28.02.10
    
    SQL> select trunc(add_months(sysdate,-1),'MM') from dual
    
    TRUNC(AD
    --------
    01.02.10
    
    SQL> 
    

    T

  • How to replace the first occurrence of a substring

    How to replace the first occurrence of a substring of my original string? everything built in features in PL/SL?
    EX: Original string: "webinweb" I need the output of string as: "xyzinweb" simply replace occuarnce first of 'web' by "xyz".
    SQL> select   regexp_replace('webinweb','web','xyz',1,1) from dual
    /
    REGEXP_R
    --------
    xyzinweb
    
  • How to extract the date of birth of the employee Table

    Hi experts,

    I'm new to SQL, help for my problem Pls

    I saw an employee table
    CREATE TABLE 'NIM_EMP '.
    (VARCHAR2 (20) "EMP_NO")
    "EMP_NAME' VARCHAR2 (100),
    VARCHAR2 (50) "EMP_DESIG."
    'HIRE_DATE' DATE,
    NUMBER OF "EMP_SAL."
    NUMBER OF "EMP_DEPT."
    DATE OF THE "DATE OF BIRTH".
    ) ;

    with data is as

    Emp_No - 203
    EMP_Name - Thérèse
    EMP_Desg - system administrator
    HIRE_Date - 10/12/2011
    EMP_SAL - 25000
    EMP_DEPT - 10
    DATE OF BIRTH - 09/02/1987

    Problem-1 - I want to show the birthday information to all users, because "it is today the anniversary of Mr.Upendran as - 25 years"

    Problem-2 - "today, Mr. Upendran is completed a year of Service in our concern" (this is based on the Date of HIRING)

    How to extract data from SQl

    Thanks in advance,
    Thérèse

    913370, you are right in both cases. I have corrected my code for the raw material.
    The second question may be fixed, because there is no sex information in the table.

Maybe you are looking for