Exception which checks if the Version of Oracle is Correct

Hello

I'm trying to put together a script and I would like the script to check what version of oracle is the instance of database / and then throw an exception if the script is run on the wrong version of Oracle.

I try to use the nested loops, the 2nd loop contains the code that I want to run if the oracle version is correct and throws the exception if the Oracle version is incorrect. The columns of v$ database.flashback_on and v$ database.current_scn do not exist on Oracle 9.2, what I what I use to test the version mismatch against.

So far, my script looks like:

Set serveroutput on encapsulated format
Set feedback off
set linesize 150

DECLARE
ora_version VARCHAR2 (4);
wrong_version EXCEPTION;
BEGIN
Select substr (version, 1, 4) in ora_version from v$ instance;
IF ora_version! = "10.2'."
THEN
RAISE wrong_version;
ON THE OTHER
DECLARE
TYPE t_db () IS RENDERING
dflsh v$database.flashback_on%TYPE,
dcscn v$database.current_scn%TYPE);
v_db t_db;
BEGIN
Select decode(flashback_on,'YES','Yes','NO','No').
current_scn
IN v_db from v$ database;
DBMS_OUTPUT. Put_line (' Flashback on: ' | v_db.dflsh);
DBMS_OUTPUT. Put_line (' current SNA: ' | v_db.dcscn);
END;
END IF;
EXCEPTION
WHEN wrong_version
THEN
DBMS_OUTPUT. Put_line ("bad Version of Oracle, requires a 10.2!");
END;
/

set linesize 80
Set of feedback on
Set serveroutput off

And gives me these errors:

END;
*
ERROR on line 27:
ORA-06550: line 12, column 34:
PLS-00302: component 'FLASHBACK_ON' must be declared.
ORA-06550: line 11, column 12:
PL/SQL: Ignored Element
ORA-06550: line 17, column 17:
PL/SQL: ORA-00904: "CURRENT_SCN": invalid identifier
ORA-06550: line 16, column 3:
PL/SQL: SQL statement ignored
ORA-06550: line 19, column 67:
PLS-00320: the declaration of the type of the expression is incomplete or incorrect
ORA-06550: line 19, column 3:
PL/SQL: Statement ignored
ORA-06550: line 20, column 67:
PLS-00320: the declaration of the type of the expression is incomplete or incorrect
ORA-06550: line 20, column 3:
PL/SQL: Statement ignored

Your script doesn't compile in pre - 10 g-Oracle versions.
You must use dynamic SQL statements to this end, e. g.

DECLARE
   ora_version     VARCHAR2(4);
   wrong_version   EXCEPTION;
BEGIN
   SELECT SUBSTR(VERSION, 1, 4)
     INTO ora_version
     FROM v$instance;

   IF ora_version != '10.2' THEN
      RAISE wrong_version;
   ELSE
      DECLARE
         TYPE t_db IS RECORD(
            dflsh   VARCHAR2(3),
            dcscn   NUMBER
         );

         v_db   t_db;
      BEGIN
         EXECUTE IMMEDIATE 'SELECT INITCAP(flashback_on), current_scn FROM v$database'
                      INTO v_db;

         DBMS_OUTPUT.PUT_LINE(' Flashback On : ' || v_db.dflsh);
         DBMS_OUTPUT.PUT_LINE(' Current SCN : ' || v_db.dcscn);
      END;
   END IF;
EXCEPTION
   WHEN wrong_version THEN
      DBMS_OUTPUT.PUT_LINE('Wrong Version of Oracle, requires 10.2 !!!');
END;
/

HTH, Urs

Tags: Database

Similar Questions

  • How can I use SQL to check the Version of Oracle Forms and object of the request?

    Hi all:

    How can I use SQL to check the Version of Oracle Forms and object of the request?





    Concerning
    Terry

    Terry,

    See the following threads/docs for the version of forms.

    How to find the developer version
    Re: How to find the developer version

    Note: 466890.1 - Script to find the Apache, Java, Jinitiator, version of forms and details of the JVM for Oracle E-Business Suite 11i
    Note: 392793.1 - how to get Forms Oracle Oracle Applications 11i Command Line Version
    Note: 468311.1 - Script to find the Apache, Java, JRE, Forms for Oracle E-Business Suite R12 version

    What purpose are you talking?

    Thank you
    Hussein

  • How can I check the version of Oracle on Linux?

    Hi all:

    How can I check the version of Oracle on Linux?




    Concerning
    Terry

    Hi terry;

    How can I check the version of Oracle on Linux?

    You mean your version of db or something else? If you mean you want to check your version number is:

    env as oramgr source file
    sqlplus "virtue sysdba".

    When you open a sqlplus session it will give u something like below:

    SQL * more: Release 10.2.0.4.0 - Production on

    Respect of
    HELIOS

  • How to check the version installed oracle RAC

    Hi all

    Y at - it a command or file to the version installed oracle RAC. I saw some post to the topic to connect to sqlplus and access the v version $ but I need a command that does not require database either upward. I mean, even if the database is down, I should be able to know the version of oracle RAC.

    Thank you very much for your help in advance,

    I must admit that I never installed Oracle without the GUI, but I strongly think it is works, no matter how you installed Oracle. opatch is one of the essential tools that comprise an oracle installation, without him you wouldn't be able to fix your installation.

    Bjoern

  • How to remove the version of Oracle reports

    Hi all

    I'm trying to run a .sql file

    coil aPOORVA_TEST.log;
    --------------------------------------------------------------------
    SET ECHO Off;
    TOGETHER TO DEFINE
    Set feedback off;
    Set the off position;
    set line 5000;

    SELECT * FROM table WHERE ROWNUM < 3.

    Spool Off;

    The result of this query is indicating the Version of Oracle and the result of the query
    SQL * more: release 9.2.0.6.0 - Production on Fri may 8 04:11:13 2009

    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64 bit Production
    With partitioning, OLAP and Data Mining options

    How could I delete those which command SET is wrong. Please notify.

    You have a

    sqlplus username/password@database 
    

    order somewhere in the .sql file? How do you run the .sql file?

    After scoring in the SQL * more console?

    If you use the sqlplus command in the sql file, then just remove the output with - SILENT or - s option.

    See you soon
    Sarma.

  • get the version of oracle

    Y at - it an easy way to return the version of Oracle from a server.

    I don't know dbms_db_version.version but that returns me only the first issue
    That is to say

    SET SERVEROUTPUT ON
    EXEC dbms_output.put_line (dbms_db_version.version);
    11 < < == response

    I also know that I can do somehting like this

    Select selection * v $ version where banner like 'Oracle % ';
    Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production < < == response

    Can I use probably sed to parse 11.1.0.7.0

    Is there an easier way to obtain this value 11.1.0.7.0 with a query? If so, would someone mind sharing. Yes, I want the
    back to the full version.

    Thank you

    You can try:

    SELECT version FROM v$instance;
    

    I hope this helps!

  • find the version of oracle at the os level

    How can Hi I find oracle version installed...

    the task, applied to the base...

    and the bug fixed, applied and opatch or not

    Thank you

    user625256 wrote:
    Hi, Laura Gaigala, $

    Thank you for the information.

    I had just installed 9.2.0.1 how those installed at oslevel is there any file

    If you have installed, then you probably know what you have installed Yes? :)
    But well, guess, you don't know what is running on this box and want to study.
    for the first look in
    / etc/oratab - this will show (not always) how various oracle_homes are installed, what sid are probably in use and where are oracle_homes. But as I said - not always, this file will show correct version.
    You can
    ps - ef | grep tns
    [oraatest@rasa central_inventory] $ ps - ef | grep tns
    oraatest 558 6754 0 08:44 pts/0 00:00:00 grep tns
    6790 1 oraatest 0 Mar06 pts/0 00:00:35 / u01/atest/oracle/product/920/bin/tnslsnr ATEST-inherit
    7307 1 oraftest 0 Mar06 pts/0 00:01:18 / u01/$ftest/oracle/product/920/bin/tnslsnr FTEST-inherit
    8178 1 oratest 0 Mar06 pts/0 00:00:35 / u01/test/oracle/product/920/bin/tnslsnr TEST - inherit

    You can see listner is running
    [oraatest@]$ lsnrctl status FTEST |] grep-i version
    LSNRCTL for Linux: Version 9.2.0.8.0 - Production on March 10, 2009 08:43:41
    [oraatest@]$

    It's showing that at least listener is 9.2.0.8, it is quite possible that db will have the same version, but we will check.

    For the version of the database, the more le plus facile easy would just look in the alert.log to particular db, then only you know where is alert.log for the particular database.
    [oraatest @ bdump] $ grep 'start-up' alert_FTEST.log-i
    Commissioning ORACLE RDBMS Version: 9.2.0.8.0.
    Commissioning ORACLE RDBMS Version: 9.2.0.8.0.
    Commissioning ORACLE RDBMS Version: 9.2.0.8.0.
    Commissioning ORACLE RDBMS Version: 9.2.0.8.0.
    [oraatest @ bdump] $

    Another way is to check the version of sqlplus
    sqlplus - v

  • Compatibility of the versions of oracle with RHEL versions

    where can I find a document on the COMPATIBILITY of oracle 11.2.x with RHEL 5, 6 in the oracle support?

    Go to the website of oracle--> certification support

  • How to upgrade the version of oracle wallet manager

    Hello

    We use Oracle Application server 10g and in our system Oracle wallet manager version 3.

    Currently, we are unable to create the CSR file generated with the SHA1 using Portfolio Manager of Oraclealgorithm.

    Is it possible to update the Oracle wallet manager ?

    Please guide.


    Concerning


    Hello

    Portfolio Manager of Oracle that comes with the OAS 10 g cannot be upgraded.

    You must upgrade complete Oracle home itself so that the OWM gets updated with it.

    Thank you

    Sharmela

  • function which checks if the input text is the same as the text in the Flash file

    Hello!

    I'm doing a Flash AS2 project for learning the word and I would like to know your opinions and your advice on this topic:

    I have Word check the task, where you have to write (text input) the correct names under these 3 photos and check if you wrote them properly with the key - "CHECK!"

    It would be simple, but it is mandatory that the text of the inscription must be compared to a text file and then checked if they match.

    I added a picture to better understand...

    Picture1.png

    Is this possible in AS2?

    Thank you!

    you don't know.

    Use the text property of the textfield object and load the text file using loadvars.  you will have to parse text loaded using the string of flash (and perhaps array) methods.

    p.s. that apple looks more like a tomato for me.

  • Data error (cyclic redundancy check) and the disc does not work correctly

    Original title: I installed the mainly broadcasts music on this disc many times without probs, now I get "data error (cyclic redundancy check)".

    I installed it now mainly music programs of this pile of disc of times with no probs, I get the error message "data error (cyclic redundancy check)" on all the programs on this disc, when I put the disc in the drive of my pc seems to be a bit slower than normal too. one of the programs is fruityloops 8, if I click on install, but click on fruityloops 8 engine I get ' ZipMsgXX.res is probably not related to the executable string ID missing is 11036' as I have 6 fruity, I thought that it could install using Installer 6 fruity but it wont... someone help...

    Hi shaunrollett,

    Control of cyclic redundancy or CRC errors, usually occur when copying data to a CD or DVD. The error may indicate a bad block, a damaged disc or a hardware problem.

    You can check whether or not the CD works in another computer.

    You can try to run the Fixit mentioned in the link below and check if it helps to reolve the question:

    Your CD or DVD drive cannot read or write media

    http://support.Microsoft.com/mats/cd_dvd_drive_problem

    Hope this information is useful.

  • I keep getting messages "Flash obsolete. Firefox Plugin Check says it is up-to-date with the version 11.2.202.418 but the current version is *. 425 cannot be installed.

    I use Ubuntu 14.

    These last days (say, a week) I get messages saying that the Flash is obsolete, and firefox blocks the plugin, so I have to unlock ('allow') every time that I get to a new page. It's no big deal, but it's boring and, for example, I can't watch movies on my page of favorite movie...
    In the firefox Plugin Check page, I get a message 'to day', but it shows the version 11.2.202.418, which is also the version of Ubuntu Software Center and current version is 11.2.202.425. I tried this https://support.mozilla.org/en-US/kb/keep-flash-up-to-date-and-troubleshoot-problems#w_updating-flash for a manual installation instructions, but cannot get to the place where firefox is installed.

    I already moved chrome Firefox because of repeated malfuntioning of chrome, I have nowhere to go! (pity me).

    Thanks to you all! And sorry for the spelling mistakes / syntactic possibilities, English is not my first language.

    I think Unbuntu would have an update now that 11.2.202.425 has been out of Adobe since December 9 as 11.2.202.424 and is more vulnerable.

    Find the .mozilla folder at / and create a folder called plugins , so you can place the libflashplayer.so file here.

    Now, all installations of Firefox and SeaMonkey will be able to use it.

    Flash 11.2.202.425 tarball is to
    https://www.Adobe.com/products/flashplayer/distribution3.html

    https://helpx.Adobe.com/security/products/Flash-Player/apsb14-27.html

  • Determine the versions of the instances of oracle running on a computer

    Operating system: AIX 5.3
    A guy from MQ (websphere) just asked that he wants to know the Version of Oracle of all instances running in a machine.
    What is the best way to determine this? It is not connected as user ORACLE BONES or have access to one of the diagrams in these databases.

    Published by: JOE_humble on January 30, 2009 01:15

    And because of this you should help him gather information if you have access to the server and necessary rights of course.

  • Student about the versions of Dreamweaver and Photoshop on CC

    Hello

    I recently signed up for CC for the teams as part of a summer course that I take my multimedia Production called University.  I received and activated the following message appears in my email:

    Hello
    You have been assigned a creative cloud - membership applications. This gives you access to the collection full creative cloud office products - with the benefits of level team.
    .. .you will use Adobe software and free to use. You must click on the activation link and use the e-mail address used in this post to create an Adobe ID (instructions for how to do this are provided once you click on the activation link). Once you've created an Adobe ID for the email used in this post, you can download Adobe Cloud Desktop App and install Dreamweaver and Photoshop for beginners on your computer. Be prepared that it will take a while.
    To start your membership, you will need to create an Adobe ID or sign in with an Adobe ID existing using this email address. Click below to accept the invitation.

    OK, well.  It is said that once I have download, I would have free access to Dreamweaver and Photoshop as long the class lights (8 weeks).  Then I do all this; I have downloaded/installed CC for teams on my computer, and then once it is I downloaded/installed the latest versions of Photoshop and Dreamweaver, Dreamweaver CC 2015 and Photoshop CC 2015.

    But then, once I tried to download and install DW and PS, they are trial versions only, whereas they should be non-epreuve versions.  Quick glance:

    http://content.screencast.com/users/nr441/folders/Jing/media/0eb08f73-A843-44e0-8c3d-f0963 b905191/00000016.png

    I checked a day later to ensure that these versions are trial versions and so problematic for my course:

    http://content.screencast.com/users/nr441/folders/Jing/media/b759ad11-821e-4E14-900b-28447 c64e359/00000017.png

    My question to Adobe customer service: Please help me!  I have absolutely no idea whatsoever about how to get to the correct version of DW and PS for my class.  The only other version that is still available is the one that must be purchased, which is not the version that we use for the class (I asked my teacher).  No one else in my class seem to have this problem.  What I did wrong, how can I solve this problem, and on the EARTH I'm looking for versions of the software that I need next week?

    Your subscription to cloud shows correctly on your account page?

    https://www.adobe.com/account.html for subscriptions on your page from Adobe

    If you have more than one email, you will be sure that you use the right Adobe ID?

    .

    If Yes

    Sign out of your account of cloud... Restart your computer... Connect to your paid account of cloud

    -Connect using http://helpx.adobe.com/x-productkb/policy-pricing/account-password-sign-faq.html

    -http://helpx.adobe.com/creative-cloud/kb/sign-in-out-creative-cloud-desktop-app.html

    -http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html

    -http://helpx.adobe.com/creative-suite/kb/trial--1-launch.html

    -ID help https://helpx.adobe.com/contact.html?step=ZNA_id-signing_stillNeedHelp

    -http://helpx.adobe.com/creative-cloud/kb/license-this-software.html

    .

    If no

    This is an open forum, Adobe support... you need Adobe personnel to help

    Adobe contact information - http://helpx.adobe.com/contact.html

    Chat/phone: Mon - Fri 05:00-19:00 (US Pacific time) <===> NOTE DAYS AND TIME

    -Select your product and what you need help with

    -Click on the blue box "still need help? Contact us. "

  • FILL MONTHS DYNAMICALLY IN THE ITEM VIA ORACLE FORMS GROUP RECORDING LIST

    Experts

    I have a query in oracle forms. I need to fill Last_Month, Current_Month & Next_month based on Sys_Date in the list box. I am able to get the values in SQL if I run the query below, but when I use the version of Oracle Forms 10.1.2.0.2, I could not get the values of Mr. can you please guide me where I'm wrong.

    declare

    v_rg_id recordgroup: = NULL;

    Number of V_errorcode;

    v_rg_salmth varchar2 (30): = "MONTHS";

    Begin

    v_rg_id: = find_group (v_rg_salmth);

    If id_null (v_rg_id) then

    v_rg_id: = create_group_from_query (v_rg_salmth,

    "WITH (AS MONTH_COUNTER)

    SELECT LEVEL 2 AS ID

    OF THE DOUBLE

    CONNECT BY LEVEL = 2

    UNION

    SELECT LEVEL AS ID

    OF THE DOUBLE

    CONNECT BY LEVEL = 0

    )

    SELECT TO_CHAR (ADD_MONTHS (TO_CHAR (SYSDATE), ID), MONTH) AS MONTH_COUNTER MONTHS ');

    v_errorcode: = populate_group (v_rg_id);

    If v_errorcode = 0 then

    message ("record group filled with data");

    on the other

    message ("V_errorcode is:" | ") v_errorcode);

    end if;

    End if;

    populate_list('MASTER.) MONTH, v_rg_id);

    end;

    The rather complicated query, try

    SELECT ADD_MONTHS (SYSDATE-1) TO DOUBLE

    UNION ALL

    SELECT SYSDATE DOUBLE

    UNION ALL

    SELECT THE DOUBLE ADD_MONTHS(SYSDATE,1)

    BTW. to use a query to populate a list, you must select two values, a label and a value, check it fill listitems dynamically - Andreas Weiden - on Oracle

Maybe you are looking for