How to check if a table exists in the database or not?

People,

Hello. I use the server of Oracle 11 GR 1 material with Oracle Linux 5 database.

My instance of database is named HRCS90, which the user access Id is MyName, and his identification of user SYS system.

I have a few questions about user ID to access the PSRECDEL and PSROLEDEFN table in the HRCS90 database as below:

SQL > select * from PSRECDEL;

His output under the SYS user: table or view does not exist.

His output under user myName: no selected lines. This means that the table THAT PSRECDEL exists, and myName user can access.

SQL > select * from PSROLEDEFN;

His output under SYS and MyName: table or view does not exist.

My questions are:

How to check if a table really exists in the instance of database HRCS90 or not?

Thanks in advance.


If a table is present in the database, it must be present in DBA_OBJECTS. If he fell, he would be present in the TRASH. If he fell purged, it is not available in the database, Cant it confirm you this object is not in the database? See a little test here

SQL > CREATE TABLE TESTTAB (ID);

Table created.

SQL >

SQL > SELECT MASTER, OBJECT_NAME FROM DBA_OBJECTS WHERE OBJECT_NAME = 'TESTTAB.

OBJECT_NAME OWNER

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

SCOTT TESTTAB

SQL >

-Drop table (without purging. So now, it will be in the recyclebin)

SQL > DROP TABLE TESTTAB;

Deleted table.

SQL >

SQL > SELECT * FROM DBA_RECYCLEBIN WHERE ORIGINAL_NAME = "TESTTAB;

OBJECT_NAME ORIGINAL_NAME OWNER

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

SCOTT BIN$ 8LKloIv3SYWA0WJ33GS + Aw == $0 TESTTAB

Now see this case when you use PURGE. If it won't move the table to the trash. First of all I am clear the existing dba_recyclebin to the user entries. Then I'm falling table using purge.

SQL > PURGE TABLESPACE USERS USER SCOTT.

Purged tablespace.

SQL >

SQL > SELECT * FROM DBA_RECYCLEBIN WHERE ORIGINAL_NAME = "TESTTAB;

no selected line

SQL > CREATE TABLE TESTTAB (ID);

Table created.

SQL >

SQL > SELECT MASTER, OBJECT_NAME FROM DBA_OBJECTS WHERE OBJECT_NAME = 'TESTTAB;

OBJECT_NAME OWNER

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

SYS TESTTAB

SQL > DROP TABLE TESTTAB PURGE;

Deleted table.

SQL > SELECT * FROM DBA_RECYCLEBIN WHERE ORIGINAL_NAME = "TESTTAB;

no selected line

SQL > SELECT MASTER, OBJECT_NAME FROM DBA_OBJECTS WHERE OBJECT_NAME = 'TESTTAB;

no selected line

Since there is no entry to both DBA_OBJECTS and DBA_RECYCLEBIN. So that means that the particular object is not in the database.

Tags: Database

Similar Questions

  • How to check if a node exists in the XML file?

    I was asked to program a method to import data from xml files in our Coldfusion 8 Web site, I am new to the use of XML.

    My method worked however I encountered the following error:

    Element NETWORKORDER. SECONDARYADDRESS. CONTACTNAME is undefined in MYDOC.

    Investigation on the node in the XML file was not present.

    Is there a method I can use to resolve this error by checking if a node exists in the xml file, which works with my current code below?

    <!--> reading XML file
    < cffile action = "read" file = "D:\website\XML\#FileName#" variable = "myxml" >
    < cfset mydoc = XmlParse (myxml) >

    <!--> to extract data from the XML of NDS file
    < cfset aPrimaryContactName =(#mydoc.NetworkOrder.PrimaryAddress.ContactName#) >
    < cfset aPrimaryContactNumber =(#mydoc.NetworkOrder.PrimaryAddress.ContactNumber#) >
    < cfset aPrimaryContactNumber = tostring(#mydoc.NetworkOrder.PrimaryAddress.ContactNumber#) >
    < cfset aPrimaryContactAddressLine1 =(#mydoc.NetworkOrder.PrimaryAddress.line1#) >
    < cfset aPrimaryContactAddressLine2 =(#mydoc.NetworkOrder.PrimaryAddress.line2#) >
    < cfset aPrimaryContactAddressLine3 =(#mydoc.NetworkOrder.PrimaryAddress.line3#) >
    < cfset aPrimaryContactAddressLine4 =(#mydoc.NetworkOrder.PrimaryAddress.line4#) >
    < cfset aPrimaryContactAddressLine5 =(#mydoc.NetworkOrder.PrimaryAddress.line5#) >
    < cfset aPrimaryContactCity =(#mydoc.NetworkOrder.PrimaryAddress.City#) >
    < cfset aPrimaryContactPostcode =(#mydoc.NetworkOrder.PrimaryAddress.PostalCode#) >
    < cfset aPrimaryContactCounty =(#mydoc.NetworkOrder.PrimaryAddress.CountrySubdivision#) >
    < cfset aPrimaryContactCountryCode =(#mydoc.NetworkOrder.PrimaryAddress.CountryCode#) >
    < cfset aPrimaryContactCountry =(#mydoc.NetworkOrder.SecondaryAddress.Country#) >
    < cfset aSecondaryContactName =(#mydoc.NetworkOrder.SecondaryAddress.ContactName#) >
    < cfset aSecondaryAttentionOfName =(#mydoc.NetworkOrder.SecondaryAddress.AttentionOfName#) >
    < cfset aSecondaryContactNumber =(#mydoc.NetworkOrder.SecondaryAddress.ContactNumber#) >
    < cfset aSecondaryContactAddressLine1 =(#mydoc.NetworkOrder.SecondaryAddress.line1#) >
    < cfset aSecondaryContactAddressLine2 =(#mydoc.NetworkOrder.SecondaryAddress.line2#) >
    < cfset aSecondaryContactAddressLine3 =(#mydoc.NetworkOrder.SecondaryAddress.line3#) >
    < cfset aSecondaryContactAddressLine4 =(#mydoc.NetworkOrder.SecondaryAddress.line4#) >
    < cfset aSecondaryContactAddressLine5 =(#mydoc.NetworkOrder.SecondaryAddress.line5#) >
    < cfset aSecondaryContactCity =(#mydoc.NetworkOrder.SecondaryAddress.City#) >
    < cfset aSecondaryContactPostcode =(#mydoc.NetworkOrder.SecondaryAddress.PostalCode#) >
    < cfset aSecondaryContactCounty =(#mydoc.NetworkOrder.SecondaryAddress.CountrySubdivision#) >
    < cfset aSecondaryContactCountryCode =(#mydoc.NetworkOrder.SecondaryAddress.CountryCode#) >
    < cfset aSecondaryContactCountry =(#mydoc.NetworkOrder.SecondaryAddress.Country#) >

    Since you already have the XML parsed in a document, the easiest is to use xmlSearch(). Take a look at the doc, it is pretty easy to use. Something as simple as:

    To the most complex as:

    And in both cases:

    Read the doc and google is your friend "coldfusion xmlsearch.

  • Check if e-mail exist in the database table

    I stumbled on this a few times before, but I'm not familiar with this system, whenever you enter an emailaddress, you see as a clock indicating the system checks if the e-mail address may be used, in other words, is not yet in a table. I would like something similar and when the "audit" is done and the emailaddress is not in the DB table, the rest of the form appears, otherwise, an error message indicates the address is already in use. I guess this could be done using Javascript, but is there also a PHP way to do this?

    It's simple to achieve. Create a query that filters your e-mail address in the database table WHERE = POST of the email field in the form is sent. If the query returns a line then the email already exist, otherwise it is available and can treat the rest of the form.

  • How to check if utl_file was used in the database with the n ° / limited audit

    How can you check the database to see if any user has used the UTL_FILE pacakge?

    Thank you

    Another angle based priv study's directory objects. Read and write access to a directory object is necessary so UTL_FILE work. If some patterns have a write access to the directory objects, can create files.

    A schema that has the priv to create any directory has full access to create any necessary directory object.

    This, along with the methods suggested above, will restrict just what patterns have code and the privs required to use UTL_FILE successfully.

    If the code has been dynamic PL/SQL (an anonymous block), then who does identify actual code executed UTL_FILE, very difficult.

  • How to check if a string exists in varray or not

    Hi all

    How to check if a string exists in varray or not.

    Version Details 
    
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    SQL> get test
      1  DECLARE
      2     TYPE dnames_var IS VARRAY(7) OF VARCHAR2(30);
      3     dept_names dnames_var := dnames_var('Shipping','Sales','Finance','Payroll');
      4  BEGIN
      5    if dept_names.exists('Shipping')
      6    then
      7       dbms_output.put_line('Exists ................');
      8    end if ;
      9  /*   DBMS_OUTPUT.PUT_LINE('dept_names has ' || dept_names.COUNT
     10                          || ' elements now');
     11     DBMS_OUTPUT.PUT_LINE('dept_names''s type can hold a maximum of '
     12                           || dept_names.LIMIT || ' elements');
     13     DBMS_OUTPUT.PUT_LINE('The maximum number you can use with '
     14         || 'dept_names.EXTEND() is ' || (dept_names.LIMIT - dept_names.COUNT));
     15  */
     16* END;
     17  
     18  /
    DECLARE
    *
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at line 5
    
    
    SQL> 
    
    Any help in this regard is appreciated ...
    Thank you
    Prakash P

    Published by: prakash on April 29, 2012 05:42

    EXISTS checks for the existence of an element, not a value. Since you're using VARRAY (btw, it is not recommended), your only choice is a loop through:

    SQL> DECLARE
      2       TYPE dnames_var IS VARRAY(7) OF VARCHAR2(30);
      3       dept_names dnames_var := dnames_var('Shipping','Sales','Finance','Payroll');
      4  BEGIN
      5      for i in 1..dept_names.count loop
      6        if dept_names(i) = 'Shipping'
      7          then
      8            dbms_output.put_line('Exists ................');
      9            exit;
     10        end if;
     11      end loop;
     12  END;
     13  /
    Exists ................
    
    PL/SQL procedure successfully completed.
    
    SQL>  
    

    If you use the nested table, you can use MEMBER, SUMBULTISET, MULTISET EXCEPT:

    SQL> DECLARE
      2       TYPE dnames_var IS TABLE OF VARCHAR2(30);
      3       dept_names dnames_var := dnames_var('Shipping','Sales','Finance','Payroll');
      4  BEGIN
      5      if 'Shipping' member of dept_names
      6      then
      7         dbms_output.put_line('Exists ................');
      8      end if ;
      9  END;
     10  /
    Exists ................
    
    PL/SQL procedure successfully completed.
    
    SQL> DECLARE
      2       TYPE dnames_var IS TABLE OF VARCHAR2(30);
      3       dept_names dnames_var := dnames_var('Shipping','Sales','Finance','Payroll');
      4  BEGIN
      5      if dnames_var('Shipping') submultiset dept_names
      6      then
      7         dbms_output.put_line('Exists ................');
      8      end if ;
      9  END;
     10  /
    Exists ................
    
    PL/SQL procedure successfully completed.
    
    SQL> DECLARE
      2       TYPE dnames_var IS TABLE OF VARCHAR2(30);
      3       dept_names dnames_var := dnames_var('Shipping','Sales','Finance','Payroll');
      4  BEGIN
      5      if dnames_var('Shipping') multiset except dept_names = dnames_var()
      6      then
      7         dbms_output.put_line('Exists ................');
      8      end if ;
      9  END;
     10  /
    Exists ................
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    SY.

  • How can I check if a file exists in the CVI real-time?

    Also, it would be nice if designated so help file functions have been supported in real time or now.

    I tried this:

    If (GetFileAttrs (DataFileName, NULL, NULL, NULL, NULL) == - 1).

    You can check if a file exists in the CVI real-time using GetFileInfo.

    CVI provides a list of the available functions in the CVI real-time here: CVI real-time functions

  • Check if values exist in the database

    Hello

    I have problem with values that are not in the database.

    I have a form, and there are two types of users: normal and Admins.

    If the user is normal, it can not access anyone else entered the database. But the administrator can access all entries.

    I did a check in so that the normal user can only access its entries:

    < cfif NOT session. Admin AND process.addedBy NEQ #session. AccountID # >
    < cflocation url = "main.cfm" addtoken = "no" > "
    < cfelse >

    <! - rest of the form - >

    By these, a normal useer cannot access all entries other than his own.

    But for admin, an administrator can access all entries, but not the entries that are not in the database. The query bound to the form is:

    < cfquery name = "xx" datasource = "yy" >
    Select Properties entryid, addedBy, deletedBy processedBy
    Of yy
    where entryid = #URL.entryid # AND processedBy IS NULL AND deletedBy IS NULL
    < cfif NOT session. Admin > AND addedBy = #Session.AccountID #.
    < / cfif >
    So both users can access the respective entries, but when the administrator between an entryid in the URL doesn't exist not in the database, do not the page back to the home page, it shows rather the form.

    So my question is how to avoid the values not in the database.

    Thanks for the help.

    Vijayvijay77.

    Well, if you want to check that she thought, why not just use RECORDCOUNT? It's a bit what it is there for.

    SOME stuff

  • How we prevent insert if the record with same EmpName exist in the database?

    Hi all

    My use case is as follows:

    The values of user input in a form of the adf, which includes a field EmpName. Then click on submit button. If that name exists in the database, user should not be allowed to save this record and shown an alert in place that says: 'record' already exists.

    All solutions?

    Here's what you'll need:

    http://www.gabrielsideras.com/2010/09/28/ADF-unique-key-validation/

  • ashrpt - ORA-20200: samples of ASH NO exist for the DATABASE/Instance

    Hello guyes,

    Please could you help me with the generation of the report of ASHES? I have the stack on:
    "ORA-20200: NO samples of ASH does exist for the DATABASE Instance / '.

    I tried to find how to sample, but the only things I found is for statspack or awr.

    Thanks a lot :)

    redy007 wrote:
    sb92075:
    SYS@PMBTEST > select * from v version $;

    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11 g Release 11.2.0.2.0 - 64 bit version of PL/SQL Production 11.2.0.2.0 - Production
    CORE Production 11.2.0.2.0
    AMT for Linux: Version 11.2.0.2.0 - Production NLSRTL Version 11.2.0.2.0 - Production

    The active Session history exists only in the Enterprise edition.

  • How can I set up Vista so that the PC does not switch to another window (for example the Spy Sweeper alerts) while I am playing a game?

    How can I set up Vista so that the PC does not switch to another window (for example the Spy Sweeper alerts) while I am playing a game?

    Vista is not in control of this technique. Spy Sweeper needs to have an option to control that. If this isn't the case, then it is badly programmed. Flight of focus (go to another window) when it is actually needed is a big no-no for the design. I find this option, if I were you :)

  • How do I run a script only if the field is not empty

    How do I run a script only if the field is not empty

    Well well, thanks to you, I had a full date on separate days, the months and the years in different areas. But now, I have a problem, as PDF has several fields calculated with script if you enter the date calculated by all other areas, which have separated and undefinied gives me does not want to put this to not always use this field. I tried to put one conditional if else but I sale. Esto, this is what I'm wearing

    var datesol = event.value;//declaramos the variable

    If (datesol = "") {}

    this.getField('yearsol').value = "";

    this.getField('monthsol').value = "";

    this.getField('daysol').value = ""}

    else {}

    var array_datesol = datesol.split("/"); / / separamos esa con date the split funcio

    this.getField('yearsol').value = array_datesol [2];

    this.getField('monthsol').value = array_datesol [1];

    this.getField('daysol').value = array_datesol [0];

    With what they do not separate them now.

    Help please

    As mentioned, you cannot use

    If (datesol = "")

    because that sets the value of datesol to «» (you will need to double for the comparison operator =)

    If you want to run code only if it is NOT empty, while it takes:

    If (datesol <> "")

  • How can we check that the data already exist in the database

    Hi friends

    I'm trying to create a procedure for adding clients in the database with the customer id as input parameter... but if the customer details database already exists that I would update this detail and is not in the database I want to add this detail in the database... How could I do that...

    any help would be appreciated

    Thank you
    Rommy

    Hello

    If your condition is to add to a table, and if the record exists in the other table, the merge statement does not work

    Example (Please check the column name and the parameter names). I do not commit or rollback because I do not know if you control the transaction within this procedure or outside it.

    CREATE OR REPLACE PROCEDURE add_cust(I_CUST_ID        IN VARCHAR2,
                                         I_CUST_F_NAME    IN VARCHAR2,
                                         I_CUST_L_NAME    IN VARCHAR2,
                                         I_CUST_ADD       IN VARCHAR2,
                                         I_CUST_CITY      IN VARCHAR2,
                                         I_CUST_STATE     IN VARCHAR2,
                                         I_CUST_ZIP       IN VARCHAR2,
                                         I_CUST_DOB       IN DATE,
                                         I_CUST_          IN VARCHAR2,
                                         I_CUST_ACCT_TYPE IN VARCHAR2,
                                         I_START_BAL      IN NUMBER) IS
    BEGIN
       INSERT INTO CUSTOMERS C
          (CUST_ID,
           CUST_F_NAME,
           CUST_L_NAME,
           CUST_ADD,
           CUST_CITY,
           CUST_STATE,
           CUST_ZIP,
           CUST_DOB,
           CUST_)
       VALUES
          (I_CUST_ID,
           I_CUST_F_NAME,
           I_CUST_L_NAME,
           I_CUST_ADD,
           I_CUST_CITY,
           I_CUST_STATE,
           I_CUST_ZIP,
           I_CUST_DOB,
           I_CUST_);
    
    EXCEPTION
       WHEN DUP_VAL_ON_INDEX THEN
          INSERT INTO CUSTOMER_ACCT
             (CUST_ID,
              CUST_ACCT_NO,
              cust_acct_type)
          VALUES
             (I_CUST_ID,
              CUST_ACCT_SEQ.NEXTVAL, -- CUST_ACCT_SEQ is a sequence, isn't?
              I_CUST_ACCT_TYPE);
    
    END add_cust;
    

    Kind regards

  • How to find if a table exists in a particular backup?

    Hi Experts,

    How to find if a particular table exists in a specific export dump file? and also is it possible to find the same RMAN backup?

    Thank you

    Hello

    Sorry, above is not possible. My bad,

    You can use below,

    Impdp directory = 'EXPDP"dumpfile = scott.dmp sqlfile = happy test.sql = metadata_only

    and the test.sql contain instructions ddl for tables in the dumpfile.

    Tested on 11.2.0.4

  • How to check if a file exists?

    Hi guys.

    I am running javascript in Acrobat .pdf file created in LiveCycle Designer.

    I need to check in silence if an external file outside the open document (C:\something\something\something.pdf) exists or not.

    I understand that I'm only able to do this as a function of confidence within a script to the folder level javascript.  I am familiar with those.   The problem is, I don't know what function I should use and will have a difficult time in the research on it.

    Try to use: doc.exists?

    Try to open the document with a function and catch the error if the file does not exist?

    I'm not so sure that if I just spend my path as a string, say "/ C/Something/something/something.pdf" or if I should first deal with the file as an object like:

    var myFile = new File("/C/Something/something/something.pdf") (which was not in Acrobat... don't try to run it as a function of confidence)

    Please notify.

    Thank you!

    I finished this figure myself.

    XFA/JavaScript in my paper, I call a custom function that I have written and pass a string (or a string variable containing) my file path for that I would like to check:

    if(typeof(MJS_FileExists) == "function") {
        try {
            if(MJS_FileExists("/C/something/somethingelse/filetocheckfor.pdf") == true) {
                xfa.host.messageBox("file is there");
            } else {
                xfa.host.messageBox("file is NOT there");
            }
        }
        catch(e) {
            app.alert("Processing error: "+e)
        }
    }
    

    The function I call is a folder level javascript.   You have to maybe do some Googleing on how and where to install them.   In the my file .js file real javascript level where the function is housed I use:

    var MJS_FileExists = app.trustedFunction(function(filename) {
        app.beginPriv();
        var existingDoc = false;
        try {
             var checkDoc = app.openDoc(filename);
             checkDoc.closeDoc();
         existingDoc = true;
        } catch(e) {
         existingDoc = false;
        }
        return existingDoc;
        app.endPriv();
    });
    

    It took me a lot of trial and error.  It sucks there is not a lot of in on the internet on how to do it via Acrobat / Live Cycle.   Hope this helps someone else.

  • How to check if a folder exists

    Hello

    I have a custom filter component:
    public class BarcodeMetadataFilter implements FilterImplementor{
    }
    I check here if the file exists in xCollectionId value, so I have two qustions:

    (1) should what service I call to check if the file exists?
    (2) how to call this service from the filter?

    Kuba

    Call a service such as COLLECTION_GET_INFO. Pass the parameter dCollectionID which must be xCollectionID. If you receive and error, it may mean that the folder does not exist. You should check the error (exception) to ensure what he wants to say to you is that the folder does not exist.

    http://docs.Oracle.com/CD/E23943_01/doc.1111/e11011/c07_folders.htm#i1082467

    The following blog post will show you how to run a service, a filter: http://jonathanhult.com/blog/2012/06/execute-a-service-from-a-java-filter/

    Jonathan
    http://jonathanhult.com

Maybe you are looking for