Home > database >  For help, I what's the problem with the SQL statement
For help, I what's the problem with the SQL statement

Time:09-28

Declare
Num1 int.
The BEGIN

Select count (1) into num1 from user_ind_columns where index_name=(' IDX_M_ID ');
IF num1 & gt;=1 then
Dbms_output. PUT_LINE (' index exists);
The ELSE
The Execute immediate 'the create index IDX_M_ID on TRANSACTION_RECORD M_ID (DESC); ';
End the IF;

Select count (1) into num1 from user_ind_columns where index_name=(' IDX_IST_TIME ');
IF num1 & gt;=1 then
Dbms_output. PUT_LINE (' index exists);
The ELSE
The Execute immediate 'the create index IDX_IST_TIME on TRANSACTION_RECORD (IST_TIME DESC); ';
End the IF;

Select count (1) into num1 from user_ind_columns where index_name=(' IDX_EVT_TRACE_ID ');
IF num1 & gt;=1 then
Dbms_output. PUT_LINE (' index exists);
The ELSE
The Execute immediate 'the create index IDX_EVT_TRACE_ID on TRANSACTION_RECORD (EVT_TRACE_ID DESC); ';
End the IF;
end;


Has been submitted to the 00911 and 06512

CodePudding user response:

Where index_name=(' IDX_M_ID) these don't need braces,

CodePudding user response:

The Execute immediate 'the create index IDX_EVT_TRACE_ID on TRANSACTION_RECORD (EVT_TRACE_ID DESC); ';

In the middle of the semicolon, like this:

The Execute immediate 'the create index IDX_EVT_TRACE_ID on TRANSACTION_RECORD (EVT_TRACE_ID DESC)';
  • Related