Accessing a sequence which does not exists

i have pl/sql code as below and the sequence  value is displayed based on condition.In case the sequence  does not exists and condition fails  the pl/sql is not getting compiled and throws error  saying that  sequence does not exists.
For eg:
declare
i number;
begin
if ( 1=2)  then
select  top_seq.nextval into i from dual;
dbms_output.put_line('i'||i);
end if;
end;
in above sequence  does not exist and condition is failed as it never access sequence, does the pl/sql  code execute successfully and  which is not  happening as it throws error  . sequence does not exists.

910111 wrote:
Hi,
as Frank mentioned before, you can achieve that by using dynamic sql, see following example:
DECLARE
  lc_sql       VARCHAR2(4000);
  ln_seqExists NUMBER       := 0;
  lc_seqName   VARCHAR2(30) := 'TOP_SEQ';
  i            NUMBER;
BEGIN
  SELECT NVL(COUNT(*),0)
  INTO ln_seqExists
  FROM user_sequences
  WHERE sequence_name = lc_seqName;
  IF ln_seqExists     = 0 THEN
    lc_sql           := 'CREATE SEQUENCE ' || lc_seqName;
    EXECUTE immediate lc_sql;
  END IF;
  IF ( 1    = 1) THEN
    lc_sql := 'select  top_seq.nextval from dual';
    EXECUTE immediate lc_sql INTO i;
    dbms_output.put_line('i: ' || i);
  END IF;
EXCEPTION
WHEN OTHERS THEN
  dbms_output.put_line(sqlerrm);
END;
Regards
Not everything that can be done should be done .... 
Before showing someone how to shoot themselves in the foot, it would be best to determine that shooting themselves in the foot is the best and most appropriate course of action.

Similar Messages

  • IP : Forecast function error. "Sequence %ADHOC does not exist"

    I have created a forecast function which would use Periods(08,09 & 10) to forecast periods 11 & 12. When I test the function using the Planning Wizard, I get an error message "Sequence %ADHOC does not exist" . Any inputs  ? I have put a debug breakpoint in the Class : CL_RSPLFC_FORECAST but the control is not even getting there. Thanks.

    Hi,
    did you try to create a planning sequence in the modeler, include you function there and test it in modeler?
    I had once a problem, that a function in planning modeler and wizard did not work, but it worked in the web template, so if it does not work in planning modeler, you might even try it in a web template.
    regards
    Cornelia

  • How do i remove my old Apple Id from iPhone's iCloud setting which does not exist anymore

    Purchased new iphone 5s, installed with itunes restoring backup from iphone 4 (which was too old a backup). It restored an old apple id (which i do not use anymore) in the iCloud settings while having my new Apple Id in the Itunes & App Store. I cannot turn off the iCloud setting due to old AppleId popping up - which does not exist.. How do i remove the old Apple Id from icloud setting on the phone.
    I cannot erase the phone as it asks for the password for the old Apple Id. And i cannot do the restore again (after i made a recent back up my iphone 4) as itunes asks me to turn off Find my phone.

    The Apple ID exists. The email address you used to create it may not, but the Apple ID does. Call AppleCare and ask to speak to someone in account security.

  • Document Sequence Information Does not Exist for Bank Account

    Hello,
    Oracle E-Bus Suite: 11.5.10.2
    OS: Windows 2003
    We are facing the problem while executing the ARPLABIM - Bank Statement Import program, 'Document Sequence Information Does not Exist for Bank Account'.
    We have already reviewed Oracle Metalink Document: Document Sequence Information Does not Exist for Bank Account: Doc ID: Note:147773.1.
    https://metalink.oracle.com/metalink/plsql/f?p=130:14:3345134018905587318::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,147773.1,1,1,1,helvetica
    But the profile option Sequential Numbering cannot be set to Not Used due to certain funcational limitations. Please advise any other workaround.
    Thank you

    Adith,
    There are only two options:
    1. Setup document Sequence. OR
    2. Change the profile either the user level who runs this program (assuming a batch user name) or at the resp or application level. Not necessarily at the site level.
    Thanks
    Nagamohan

  • TS3212 When I try to download iTune, it shows Drive K which does not exist in my computer. It does not allow me to change to other Drive and terminate download stating ' out of disk capacity"

    Whne I download iTune, it shows that it will be downloaded to Drive K which does not exist in my computer. It does not allow me to change to other Drives has enough capacity. Then I click change bottom, attempting to change drive, it terminates the download.
    Do you have any solutions??

    Try "Invalid drive X:\" install errors. You should still be able to chose the drive for the download when downloading the installer with a web browser. The iTunes application is installed on the active system drive, usually drive C:.
    tt2

  • HT201363 i have forgotten the security code and an e-mail is being sent to an e-mail account which does not exist.  How do i change the e-mail details

    We have forgotten the security code question and each time I request a reset it is being sent to an e-mail addres which does not exist.  How can I change the e-mail address to my current e-mail address.  We have put money onto an ITunes account which is asking for this security question.  This has never happened before. Any assistance would be appreciated.  thank you

    Hello, covey98. 
    Thank you for visiting Apple Support Communities.
    I would recommend reaching out to us via the link below to assist you with this issue.
    Apple ID: Contacting Apple for help with Apple ID account security
    http://support.apple.com/kb/HT5699
    Cheers,
    Jason H.

  • Calling a remote enabled function module which does not exist in caller sys

    Hi,
    I have a a system ABC from which I am trying call a rfc enabled fm(Test) present in system XYZ.
    The fm(Test) does not exist in the system ABC so I am getting generation errors and dumps.
    Is there a way for me to call these remote enabled function modules which does not exist in the caller system without the obvious errors etc.
    Is there any special way.
    Thanks

    Hi,
    please check this sample:
    REPORT  zcallfm                                 .
    DATA: xv_return TYPE sysubrc.
    CALL FUNCTION 'DOESNOTEXIST'
    DESTINATION   'NOWHERE'
    EXPORTING     caller                = sy-sysid
    IMPORTING     return                = xv_return
    EXCEPTIONS    system_failure        = 1
                  communication_failure = 2
                  OTHERS                = 4.
    It shouldn't throw any generation errors in your system!
    Regards,
    Klaus

  • Table compare deleting rows which does not exist in target table

    Hi Gurus,
    I am struggling with an issue in Data Services.
    I have a job which uses Table Compare, then History Preserving and then a Key Generation transforms.
    There is every possibility that data would get deleted from the source table.
    Now, I want to delete them from the target table also.
    I tried Detect deleted rows but it is not working.
    Could some one please help me on this issue.
    Thanks,
    Raviteja.

    Doesn't history preserving really only operate on "Update" rows.  Wouldn't it only process the deletes if you turned the "Preserve Delete row(s) as update row(s)" on?
    I would think if you turned on Detect Delete rows in the Table compare and did not turn this on in the history preserving it would retain those rows as delete rows and effectively remove them from the target.
    Preserve delete row(s) as update row(s)
    Converts DELETE rows to UPDATE rows in the target warehouse and, if you previously set effective date values (Valid from and Valid to), sets the Valid To value to the execution date. Use this option to maintain slowly changing dimensions by feeding a complete data set first through the Table Comparison transform with its Detect deleted row(s) from comparison table
    option selected.

  • The user which does not exist can login BI Answers without password

    Hi I got an Issue in the BI Answers login.
    Any non-exist username can login to the BI answers without password.
    And the exist-user need the correct password.
    Does anybody have the same issue before?
    And also, any non-exist username can login to BI Answers if the password is provided as the same as username, even the user account doesn't exist.
    After the non-exist user login, the system would automatilly create this user account.
    Edited by: Jinfeng Ling on Dec 19, 2008 7:04 AM

    Hi Madan
    The Security Section in my NQSConfig.INI file is following:
    # Security Section
    # Legal value for DEFAULT_PRIVILEGES are:
    # NONE READ
    [ SECURITY ]
    DEFAULT_PRIVILEGES = READ;
    PROJECT_INACCESSIBLE_COLUMN_AS_NULL     =     NO;
    MINIMUM_PASSWORD_LENGTH     =     0;
    #SSL=NO;
    #SSL_CERTIFICATE_FILE="servercert.pem";
    #SSL_PRIVATE_KEY_FILE="serverkey.pem";
    #SSL_PK_PASSPHRASE_FILE="serverpwd.txt";
    #SSL_PK_PASSPHRASE_PROGRAM="sitepwd.exe";
    #SSL_VERIFY_PEER=NO;
    #SSL_CA_CERTIFICATE_DIR="CACertDIR";
    #SSL_CA_CERTIFICATE_FILE="CACertFile";
    #SSL_TRUSTED_PEER_DNS="";
    #SSL_CERT_VERIFICATION_DEPTH=9;
    #SSL_CIPHER_LIST="";
    # There are 3 types of authentication. The default is NQS
    # You can select only one of them
    #----- 1 -----
    #AUTHENTICATION_TYPE = NQS; // optional and default
    #----- 2 -----
    #AUTHENTICATION_TYPE = DATABASE;
    # [ DATABASE ]
    # DATABASE = "some_data_base";
    #----- 3 -----
    #AUTHENTICATION_TYPE = BYPASS_NQS;
    Can you see any problem?
    Thanks!
    Jinfeng

  • I am having difficulty updating my iphone apps. Living in Bermuda it keeps wanting to default to the Bermuda store, which does not exist. I turned off the location services which appears to solve this problem, but I use this function a lot so do not want

    I am having difficulty updating my iphone apps. Living in Bermuda it wants to default to a nonexistant Bermuda app store. I solved by turning off the location finder, but this is a function I use and need, and dont want the hassle of constantly switching back and forth. Is there a simple solution

    I agree. I don't rely on iCloud as a backup, that is what I have my portable hard drive for. Its 500 GB so I can hold my entire iTunes library several times over on it. I have all my movies on my hard drive, but somehow "The Mist" got deleted off of my hard drive, so I figured "Well, the option to redownload an already purchased movie is available through iCloud, I'll just do that!"
    And permissions and download availability have nothing to do with it, the movie's still there, it still allows me to redownload it. The only problem is when I click download, I get that message.
    And nobody else uses my computer, but I do have multiple accounts authorized on it. Even still though, I am attepmpting to download it through the account I purchased it under. :/

  • Workflow error [WF_ERROR] ERROR_MESSAGE=ORA-02289: sequence does not exist

    Dears,
    I created simple custom workflow (Start -> Notification -> End).
    I got the following error when I run the workflow.
    [WF_ERROR] ERROR_MESSAGE=ORA-02289: sequence does not exist ERROR_STACK= FND_SEARCH_EVENTS.On_Object_Change(oracle.apps.wf.notification.send, 5C84790B967158FFE04400144F23BF3C)
    The notification activity returned this error but the notification has been sent to performer.
    I searched for solution to fix this problem and I found one result for the same problem without any solution.
    http://www.itpub.net/thread-1558559-1-1.html
    Thank you

    It looks as if DB sequence FND_SEARCH_EVENTS_SEQ does not exist. Please try to reload it as follows:
    java oracle.apps.fnd.odf2.FndXdfCmp applsys <pwd> apps <pwd> thin "<db server>:<db port>:<SID>" all $FND_TOP/patch/115/xdf/fnd_search_events_seq.xdf $FND_TOP/patch/115/xdf/xsl
    Regards,
    Alejandro

  • Under what conditions  ALL Objects exists and does not exists

    When does the ALL Objects exists in Database
    For Eg: ALL_TAB_COLUMNS , ALL_USERS etc
    When it does not exists
    For Eg : ALL_SEGMENTS which does not exist and only options are USER_SEGMENTS and DBA_SEGMENTS.
    There should be some rules for its existence and its non existence and under what conditions it exists and does not exists .
    Please explain.

    Its clearly stated in Oracle documentation.
    An ALL_ view displays all the information accessible to the current user, including information from the current user's schema as well as information from objects in other schemas, if the current user has access to those objects by way of grants of privileges or roles.
    A DBA_ view displays all relevant information in the entire database. DBA_ views are intended only for administrators. They can be accessed only by users with the SELECT ANY TABLE privilege. This privilege is assigned to the DBA role when the system is initially installed.
    A USER_ view displays all the information from the schema of the current user. No special privileges are required to query these views.
    Edit: formatted the post :)

  • My iphone 4s has a built in app called "voice Memos".  A colleague has an iPhone 4 unit which does not have this app. This has beem on my previous models.  Has it been discontinued? Is  it a carrier issue?

    "1  Which iphone models have the built in VOICE MEMOS app?  My 4S model has this, and i have also had this on my previous model.  A colleague has an iphone 4, and it is not showing.
    #2  Also, my 4S has a smart keyboard with the microphone icon to the left of the spacebar.  Which models have this?

    1) Either your friend has moved the icon into a folder or onto another screen, or they do not have a real iPhone (or their phone is jailbroken). It is present on all iPhones and can not be deleted.
    2) The 4S and higher have that. It requires Siri, which does not exist on the iPhone 4 and earlier.

  • BI Admin Cockpit - RSIM_CHECK_REP_DATA  does not exist

    Hi All,
    we recently upgraded to BW731 SP06 and had quite some issues with the BI Admin Cockpit. Most of them have been solved in the meantime, however process chain 0TCTHC_CHECK_REP_DATA calls a program (RSIM_CHECK_REP_DATA) which does not exist. It seems this does exist in lower releases (BW730 SP05 according to scn.sap.com/message/14065174).
    I checked the service Marketplace and could only find 1 ancient note for BW7.11 (which is obviously not applicable in our current version).
    Should I open an(other) OSS message for this?
    Kind regards,
    Raf

    Hi Raf,
    We have  the above program and other details are below.
    BI Cont - 736 level 0002 Highest support  SAPK-73602INBICONT
    SAP BASIS 730 Level 005 high supp pkg - SAPKB73005
    There would be chance of missing, you may need respective note, better to check with SAP.
    Thanks

  • Using SSIS 2012 - merge join component to transfer data to destination provided it does not exist

    HI Folks,
    I have a table - parts_amer and this table exists in source & destination server as well.
    CREATE TABLE [dbo].[Parts_AMER](
     [ServiceTag] [varchar](30) NOT NULL,
     [ComponentID] [decimal](18, 0) NOT NULL,
     [PartNumber] [varchar](20) NULL,
     [Description] [varchar](400) NULL,
     [Qty] [decimal](8, 0) NOT NULL,
     [SrcCommodityCod] [varchar](40) NULL,
     [PartShortDesc] [varchar](100) NULL,
     [SKU] [varchar](30) NULL,
     [SourceInsertUpdateDate] [datetime2](7) NOT NULL,
     CONSTRAINT [PK_Parts_AMER] PRIMARY KEY CLUSTERED
     [ServiceTag] ASC,
     [ComponentID] ASC
    I need to exec the following query using SSIS components so that only that data ,is transfered,which does not exist at destination -
    select source.*
    from parts_amer source left join parts_amer destination
    on source.ServiceTag = destination.ServiceTag
    and source.ComponentID=destination.ComponentID
    where destination.ServiceTag  is null and destination.ComponentID is null
    Question - Can Merge component help with this?
    Pl help out.
    Thanks.

    Hi Rvn_venky2605,
    The Merge Join Transformation is used to join two sorted datasets using a FULL, LEFT, or INNER join, hence, not suitable in your scenario. As James mentioned, you can use Lookup Transformation to redirect the not matched records to the destination table.
    Another option is to write a T-SQL script that makes use of
    Merge statement, and execute the script via Execute SQL Task.
    References:
    http://oakdome.com/programming/SSIS_Lookup.php 
    http://www.mssqltips.com/sqlservertip/1511/lookup-and-cache-transforms-in-sql-server-integration-services/ 
    Regards,
    Mike Yin
    TechNet Community Support

Maybe you are looking for