The following SELECT statement gives the respective details of NESTED TABLE available in a single row of parent table: select a.CompanyName,a.NoOfYears from You can also replace the word ‘table’ with another keyword ‘the’ as follows: select a.CompanyName,a.NoOfYears from Any of the above two examples performs two operations. First, it reads an ‘employees’ row with the given name. Then, it reads the elements stored in that row’s nested table. For better readability, I used ‘table’ instead of ‘the’. You can even replace the field names with ‘*’ as follows: select a.* from By now, we already know how to retrieve information from NESTED TABLEs. Now we need to know how to insert rows to the NESTED TABLE (not to the main table ‘employees’)? This means I wanted to add another ‘experience’ row to the same employee ‘jag’. The following statement does it. INSERT INTO If you compare the above example with previous SELECT statements, you should be able to understand and there is nothing new from any angle. Actually it is not necessary to use ‘t_experience’ in the above statement, you can also insert it as follows: INSERT INTO But for better readability, I suggest you to use the TYPE name along with values. You can even modify the existing rows using UPDATE statement as follows: UPDATE You can even use DELETE statement on NESTED TABLE as follows: DELETE FROM If you don’t use any OBJECT type in the NESTED TABLE (like a NESTED TABLE of varchar2, like in part-3), you can use a keyword ‘column_value’ for UPDATE or DELETE statements. It is necessary because the NESTED TABLE does not have any specific columns to address.
blog comments powered by Disqus |