Skip to main content

Automatically generate primary key value using backed Trigger in Oracle

PROBLEM : Automatically assign primary key value using backed Trigger. 

SOLUTION :  Code.
                   
CREATE OR REPLACE TRIGGER stlbas.dbt_auto_srlnum
BEFORE INSERT
   ON stlbas.stbrnlm1
   FOR EACH ROW
BEGIN
   BEGIN
      SELECT COUNT (a.sancid) + 1
        INTO :NEW.srlnum
        FROM stlbas.stbrnlm1 a
       WHERE a.sancid = :NEW.sancid;
   EXCEPTION
      WHEN NO_DATA_FOUND
      THEN
         :NEW.srlnum                := 1;
      WHEN OTHERS
      THEN
         :NEW.srlnum                := 1;
   END;
END;

Comments

Popular posts from this blog

ORA-01033 Oracle initialization or shutdown in progress

ORA-01033 Oracle initialization or shutdown in progress When you connect oracle 12c plug gable database, Thus time you have get oracle initialization or shutdown in progress error. This error occurred because pluggable database are not initialized. To fix this error connect as sysdba and run  ALTER PLUGGABLE DATABASE ALL OPEN    command. ALTER PLUGGABLE DATABASE ALL OPEN Thanks.

Oracle forms 11g default configuration file formsweb.cfg

#formsweb.cfg defines parameter values used by the FormsServlet # formsweb.cfg defines parameter values used by the FormsServlet (frmservlet) # This section defines the Default settings. Any of them may be overridden in the # following Named Configuration sections. If they are not overridden, then the # values here will be used. # The default settings comprise two types of parameters: System parameters, # which cannot be overridden in the URL, and User Parameters, which can. # Parameters which are not marked as System parameters are User parameters. # SYSTEM PARAMETERS

No free space to rebalance ASM disk group

   To day we found below warning message from Exadata system: Warning: Software Alert 92_1 Event Time 2025-01-23T16:19:57+06:00 Description Insufficient free space to rebalance the ASM disk group: RECOC1 Affected Server Name ******* Server Model Oracle Corporation ORACLE SERVER X9-2 Chassis Serial Number 2217XCD00X Release Version 24.1.5.0.0.241016 RPM Version 24.1.5.0.0.241016 Recommended Action Please refer to MOS Doc 1551288.1                                                                                                I am search  Chatgpt and found below solutions. Rebalancing an ASM (Automatic Storage Management) disk group in Oracle is a process where the disk group redistributes data...