Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This computer science problem is using Oracle Database 11g: SQL Create table Bon

ID: 3828851 • Letter: T

Question

This computer science problem is using Oracle Database 11g: SQL

Create table Bonus and do DML insert to Bonus table for the following script:

Hint: you should be able to ran this script against your table without any error and generate the output: "Here is the result". I cannot get this output need help.

SQL> select (substr                     

           (substr

              (substr(l.object,

                       instr(l.object,',')+1

                     ),

               instr(substr(l.object,                    

                      instr(l.object,',')+1),',')+1),

  instr(substr(substr(l.object,instr(l.object,',')+1),               

instr(substr(l.object,instr(l.object,',')+1),',')+1),',')+1)) ref

from Bonus l

where l.l_index = 't234';

I get the following output: Please Help Someone!

ORA-00904: "L"."L_INDEX": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:   
*Action:
Error at Line: 11 Column: 7

Explanation / Answer

Hi

I do not have your schema so let me start from zero:

1) First check if l_index is a valid column name. I am very sure it is valid.

2) Put 'as' before 'ref'.

select (substr   
(substr
(substr(l.object,
instr(l.object,',')+1
),
instr(substr(l.object,
instr(l.object,',')+1),',')+1),
instr(substr(substr(l.object,instr(l.object,',')+1),   
instr(substr(l.object,instr(l.object,',')+1),',')+1),',')+1)) as ref
from Bonus l
where l.l_index = 't234';

3) If it does not solve your problem, change your function nesting as correlation names such as l can only go one level down according to the SQL scoping rules.

Let me know if any further help is required.