Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Sequence Trigger (exclude number range) Fails wtih ORA-01403: no data found

User_I4Y3CJun 23 2020 — edited Jun 24 2020

Hello PL/SQL Experts,

I need your help. … Banging my head on the wall trying to make this simple sequence trigger work. …..

BACKGROUND:

a) I need a sequence that will update a column with a number between (1 - 10) [the column is VARCHAR2(2) datatype]

b) The table currently has values in this field that we need to maintain (3,4). So I need the sequence to skip those numbers. …

c) This also needs to work for update statements.

Attached are all the scripts I used so you can recreate the issues.

When I run an insert I get the below errors:

ORA-01403: no data found

ORA-04088: error during execution of trigger

HERE'S THE CODE:

----------------------------------

-- Create the Sequence

CREATE SEQUENCE MYSCHEMA.TEST_SEQ START WITH 1 MAXVALUE 13 INCREMENT BY 1 CYCLE NOCACHE NOORDER;

-- Create the Table

CREATE TABLE MYSCHEMA.TEST_SEQ (

item nvarchar2(2) NOT NULL,

seq nvarchar2(6) NULL)

TABLESPACE

USERS

STORAGE (initial 50k);

--Insert rows into the table

INSERT ALL

INTO MYSCHEMA.SEQ_TEST (item, seq) VALUES ('A','')

INTO MYSCHEMA.SEQ_TEST (item, seq) VALUES ('B','')

INTO MYSCHEMA.SEQ_TEST (item, seq) VALUES ('C','3')

INTO MYSCHEMA.SEQ_TEST (item, seq) VALUES ('D','4')

INTO MYSCHEMA.SEQ_TEST (item, seq) VALUES ('E','')

SELECT * FROM DUAL;

--Create the trigger

CREATE OR REPLACE TRIGGER MYSCHEMA.TEST_TRIG

BEFORE INSERT ON MYSCHEMA.TEST_SEQ

FOR EACH ROW

    DECLARE seqto NUMBER(6);

    BEGIN

      IF :new.SEQ IS NULL THEN

        IF MYSCHEMA.TEST_SEQ.NEXTVAL = '100000'

        THEN

          SELECT 104000 INTO seqto FROM DUAL;

        BEGIN

         EXECUTE IMMEDIATE 'ALTER SEQUENCE MYSCHEMA.TEST_SEQ RESTART START WITH seqto';

         SELECT MYSCHEMA.TEST_SEQ.NEXTVAL INTO :new.SEQ FROM DUAL;

        END;

        END IF;

        ELSE

          IF MYSCHEMA.TEST_SEQ.NEXTVAL = '999999'

            THEN

              BEGIN

                EXECUTE IMMEDIATE 'ALTER SEQUENCE MYSCHEMA.TEST_SEQ RESTART START WITH 1';

                SELECT MYSCHEMA.TEST_SEQ.NEXTVAL INTO :new.SEQ FROM DUAL;      

              END;

          END IF;

      END IF;   

      EXCEPTION WHEN NO_DATA_FOUND THEN

      BEGIN

        SELECT 1 INTO :new.SEQ FROM DUAL;

        INSERT INTO MYSCHEMA.SEQ_TEST (item, seq) VALUES (:new.ITEM,:new.SEQ);

    END; 

  END;

/

--Insert test rows

INSERT ALL

INTO MYSCHEMA.SEQ_TEST (item, seq) VALUES ('F','12')

INTO MYSCHEMA.SEQ_TEST (item, seq) VALUES ('G','')

SELECT * FROM DUAL;

This post has been answered by Solomon Yakobson on Jun 24 2020
Jump to Answer

Comments

SMOOTHEDATH

Hi JC ,

Can you check in your source environment from where this clone is being done ?

check below .

1) which zip

2) zip -v

If in the source environment you have 2.3 then your check with your OS vendor to get the same and get it installed on your target server

-Regards

S

Beauty_and_dBest

Hi Sohin,

# which zip

/usr/bin/zip

# zip -v

Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.

This is Zip 3.0 (July 5th 2008), by Info-ZIP.

I can not contact anymore the vendor

Is there no other available source?

Kind regards,

Vishnu Vinnakota

Hello,

   Actually you can find it in the 11i Stage if you have it or try downloading and install from below:

https://sourceforge.net/projects/infozip/files/Zip%202.2x%20and%20earlier/2.32/

   Let me know.

Thanks,

Vishnu

https://vishnu.ae

Shaik

Hi JC

Please follwo the below steps

1.1 download zip 2.3 from http://www.info-zip.org/

1.2 unzip this file to a directory

1.3 Add this directory in the PATH variable (now 'which zip' should give this location).

Please make sure you have zip version 2.3 in your PATH

Regards

Shaik

Beauty_and_dBest

Thanks Shaik, Vishnu and ALL,

I will try that...brb.

Beauty_and_dBest

Hi All,

A.

Using site > https://sourceforge.net/projects/infozip/files/Zip%202.2x%20and%20earlier/2.32/

I was able to download file > zip232.zip

But when I unzip it, there is no executable program named "zip" or "unzip".

pastedImage_8.png

B.

Using site > http://www.info-zip.org/

I can not see version 2.3

pastedImage_4.png

Please help....

Kind regards,

Shaik

Hi JC

export the path as below and try

export PATH=<location of ORACLE_HOME/bin>:$APATH

Regards

Shaik

Beauty_and_dBest

Hi Shaik,

I do not get what you want to say

What I mean is I can not find the zip 2.3 in the site you shared. I also can not find it on the local restored backup.

In EBS 12.1.3, the unzip tool is part of the restored OracleHome,  but not in EBS 11i OracleHome.

Can you check again please if you have still EBS 11i?

Kind regards,

Mohammed Ali A. Syed

Hi,

Can you find zip in restored ORACLE_HOME/bin ?

If you can find it just run the following command. (Assuming your restored binaries are in /u01/oracle/PROD/9.2.0

export PATH=/u01/oracle/PROD/9.2.0/bin:$PATH

perl adcfgclone.pl dbTier

Thanks

Mohammed Ali A. Syed

Beauty_and_dBest

Hi Mohammed,

I already source all of that

This is the contents of my .bash_profile

PATH=$PATH:$HOME/bin; export PATH

export PATH=/u02/oracle/oaproddb/9.2.0/Apache/perl/man:$PATH

export PATH=/u02/oracle/oaproddb/9.2.0/Apache/perl/:$PATH

export PERL5LIB=/u02/oracle/oaproddb/9.2.0/Apache/perl/lib/5.00503:/u02/oracle/oaproddb/9.2.0/Apache/perl/lib/site_perl/5.005

export PATH=/u02/oracle/oaproddb/9.2.0/bin:$PATH

export KSH_VERSION='@(#)PD KSH v5.2.14 99/07/13.2'

. /u02/oracle/oaproddb/9.2.0/OAPROD_oaprod.env

export PATH=$ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME:$PATH

export PATH=$ORACLE_HOME/OPatch:$PATH

echo $PATH

/u02/oracle/oaproddb/9.2.0/bin:/u02/oracle/oaproddb/9.2.0/Apache/perl/:/u02/oracle/oaproddb/9.2.0/Apache/perl/man:/u02/oracle/oaproddb/9.2.0/OPatch:/u02/oracle/oaproddb/9.2.0/appsutil/scripts/OAPROD_oaprod:/u02/oracle/oaproddb/9.2.0/Apache/perl/bin:/u02/oracle/oaproddb/9.2.0/bin:/usr/bin:/usr/sbin:/u02/oracle/oaproddb/9.2.0/jre/1.4.2/bin:/usr/ccs/bin:/bin:/usr/bin/X11:/usr/local/bin:/u02/oracle/oaproddb/9.2.0/bin:/u02/oracle/oaproddb/9.2.0/Apache/perl/:/u02/oracle/oaproddb/9.2.0/Apache/perl/man:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oraprod/bin

pastedImage_0.png

But the unzip version found is 5.42

Is it possible to rename 5.42 to 2.3? just to bypass or chit the checking?

Kind regards,

Kanda-Oracle

Hi

Can you refer (Doc ID 1303519.1)

Thanks!

Beauty_and_dBest

Hi Kanda and ALL,

I already checkED the site InfoZip, but I can not find 2.3 version

pastedImage_0.png

pastedImage_1.png

Please help...

Kind regards,

Kanda-Oracle

Hi

To cross check whether its taken effect

$ which InfoZip.zip

Hope this helps!

Thanks!

Beauty_and_dBest

Hi Kanda,

I have not downnloaded anything yet, cause the site seem frozen?

# which InfoZip.zip

/usr/bin/which: no InfoZip.zip in (/sbin:/bin:/usr/sbin:/usr/bin)

pastedImage_0.png

If i click the site, I get below error:

pastedImage_0.png

Kind regards,

Kanda-Oracle

Hi

To cross check whether its taken effect

  $ which Infozip.zip  <=== its case sensitive

Note : if infozip is part the PATH, it should reflect it.

Hope this helps!

Thanks!

Kanda-Oracle

I need to check whether

InfoZip (or) Infozip.zip (case sensitive)

Beauty_and_dBest

Hi Kanda,

[root@conv ~]# which Infozip.zip

/usr/bin/which: no Infozip.zip in (/sbin:/bin:/usr/sbin:/usr/bin)

[root@conv ~]# which InfoZip.zip

/usr/bin/which: no InfoZip.zip in (/sbin:/bin:/usr/sbin:/usr/bin)

Kind regards,

Kanda-Oracle

Hi JC

I was expecting this outcome. It seems You have not placed it in the right Path.

You need to copy the file InfoZip.zip/Infozip.zip (case sensitive) , in the right location ; For example /home/oraprod/bin

Hope this helps!

Thanks


N Kandasamy

Beauty_and_dBest

Hi Kanda,

My issue is I was not able to download the zip 2.3.

Because I can not locate it in the download site.

So how can I place it in the PATH?

Kind regards,

Kanda-Oracle
Answer

Hi

It looks like its not infozip.zip... that you should put in the PATH.

Please ignore my previous update.

You should download and from the site that is mentioned in the notes

(Doc ID 1303519.1)

(Doc ID 230672.1)

Once you get to download it , Please let us know the file name ?!?

Thanks!

Marked as Answer by Beauty_and_dBest · Jan 28 2021
Beauty_and_dBest

Hi Kanda,

That is the same note you mentioned in previous post

As as said zip 2.3 is not available in infozip site.

Kind regards,

Kanda-Oracle
  1. Can you share the version that is available..
  2. Did you copy whatever available zip / file ?
  3. Ensure its available in PATH
    •   $ which <executable name>
Beauty_and_dBest

Hi Kanda and ALL,

The unzip version available is  5.52

# which unzip

/usr/bin/unzip

[root@localhost ~]# unzip

UnZip 5.52 of 28 February 2005, by Info-ZIP.  Maintained by C. Spieler.  Send

bug reports using http://www.info-zip.org/zip-bug.html; see README for details.

Please help....

Kind regards,

RameshPatel

the zip file need should already in db_tech home.

/oracle/Appl/db/tech_st/11.1.0/bin

just reference this when running dbTier clone.

Beauty_and_dBest

Thanks Ramesh,

Just to confirm, the dbTier does not have copy of unzip 2.3  but only the appsTeir?

Kind regards,

RameshPatel

Just copy the zip from apptier to dbtier (any folder) and then set the zip variable point the zip location in the path,

Beauty_and_dBest

Thanks Ramesh,

I will try that ...brb

1 - 27

Post Details

Added on Jun 23 2020
21 comments
1,526 views