After debugging a program, if the problem occurs, you can check the information and find that Oracle does not allow you to change the NULL field to the NULL field. I had to make a judgment before the modification. Open PLSQL, such
After debugging a program, if the problem occurs, you can check the information and find that Oracle does not allow you to change the NULL field to the NULL field. I had to make a judgment before the modification. Open PL/SQL, such
After debugging a program, if the problem occurs, you can check the information and find that Oracle does not allow you to change the NULL field to the NULL field. I had to make a judgment before the modification.
Open PL/SQL and write the following code:
Declare
Visnull varchar2 (4 );
Begin
Select nullable into visnull from user_tab_columns
Where table_name = upper ('tblstockinspect ')
And column_name = upper ('fdepartid ');
If visnull = 'n' then
Alter table tblStockInspect modify FDepartID int null;
End if;
End;
Run, and the following error message appears:
---------------------------------------------------------------------------
ORA-06550: 8th rows, 7th columns:
PLS-00103: The symbol "ALTER" appears when one of the following is required:
(Begin case declare exit
For goto if loop mod null pragma raise return select update
While
<
Continue close current delete fetch lock insert open rollback
Savepoint set SQL execute commit forall merge pipe purge
---------------------------------------------------------------------------------
After careful consideration, the original alter statement cannot be run directly in PL/SQL, so you have to change it as follows:
Declare
Visnull varchar2 (4 );
Begin
Select nullable into visnull from user_tab_columns
Where table_name = upper ('tblstockinspect ')
And column_name = upper ('fdepartid ');
If visnull = 'n' then
Execute immediate 'alter table tblStockInspect modify FDepartID int null ';
End if;
End;
Run through