Equivalent to Oracle OBJECTPROPERTY

Hi friends,
I want the equivalent oracle for the following sql code,
Select @Command = 'IF OBJECTPROPERTY(object_id('''+ @TableName + '''), ''TableHasForeignRef'') = 1
                          DELETE FROM ' + @TableName + '
                      ELSE
                          TRUNCATE TABLE ' + @TableName
EXEC sp_MSForEachTable @Command
I tried to find out, but no use. Please help me.
Thank you
RAM.

S.Nayef wrote:
In any case, I guess that you need like this block:

Not really:

   SELECT COUNT ( * )
     INTO l_count
     FROM user_constraints
    WHERE table_name = l_table_name AND constraint_type = 'R' AND ROWNUM <= 1;

checks if the l_table_name table has FK. We need is to find out if any other table does reference constraint on the l_table_name table. Therefore, SQL above should be replaced by something like:

select  count(*)
  from  dba_constraints c1,
        dba_constraints c2
  where c1.owner = 
    and c1.table_name = 
    and c2.r_owner = 
and c2.r_constraint_name = c1.constraint_name and rownum = 1 /

SY.

Tags: Database

Similar Questions

  • OPENXML, sp_xml_preparedocument and sp_xml_removedocument equivalent to Oracle

    Hello

    I've stored in MSSQL, that must be translated to Oracle.

    MS in MSSQL

    CREATE PROCEDURE [dbo]. [pptChnlGrpChnl_d_xml]

    "@xmlOptinChannel nvarchar (max) - < TeamProfile > < UserProfile = companyTeamID" "userID =" "/ > < / TeamProfile >


    AS

    DECLARE @docid int

    DECLARE table (@TableOptins)

    OptinChannelGroupID int,

    ChannelID int

    )


    EXEC Sp_xml_preparedocument @docid OUT, @xmlOptinChannel

    -Populate a temporary table with records of user (s) for removal

    INSERT INTO @TableOptins (OptinChannelGroupID, ChannelID)

    SELECT tm. OptinChannelGroupID, tm. ChannelID

    OF OPENXML (@docid, "/ GroupChannels/GroupProfile")

    WITH (int OptinChannelGroupID,

    Int ChannelID) tm

    EXEC sp_xml_removedocument @docid

    Return 0

    Any suggestion?

    Oracle uses an object of type "XMLTYPE" appointed to represent an instance of XML document (or fragment) in the database.

    An instance of XMLType can be built on a file pointer (BFILE), a BLOB, a CLOB or VARCHAR2 variable or column using the corresponding XMLType constructor.

    In recent versions, Oracle recommends to use the XMLParse SQL function when dealing with an input XML string.

    If the nearest equivalent to the call to sp_xml_preparedocument and sp_xml_removedocument would simply use the XMLType constructor, or the above function.

    OPEN_XML more close 'equivalent' in Oracle's SQL/XML XMLTABLE standard function, which offers many more rich because it is based on the XQuery language.

    In your case:

    select x.OptinChannelGroupID
         , x.ChannelID
    from xmltable('/GroupChannels/GroupProfile'
           passing xmlparse(document p_input_xml)
           columns OptinChannelGroupID integer path '@OptinChannelGroupID'
                 , ChannelID           integer path '@ChannelID'
         ) x
    ;
    
  • SQLFire equivalent to Oracle's DECODE?

    I have a few views Oracle I need to migrate to SQLFire who have DECODING features in them - best practices to find out how to create equivalent SQL in SQLFire?

    Thanks, Jeff

    Hi Jeff

    The CASE expression provides a replacement in accordance with standards of the Oracle DECODE functions.

    concerning

    Felicia

  • SQL Server WaitFor Delay ' 00:00:15 ' equivalent in Oracle

    Does anyone know of an equivalent of the SQL Server SQL command WaitFor Delay ' 00:00:15 ' equivalent in SQL Oracle?

    Good, but I would say that if you do not understand WHY you wait 15 seconds then there is no need to wait 15 seconds.

    After all, it costs money ONCE to write a customization, it costs money to infinity to run bad code every day...

    Here's the code to put your DB in a useless loop.

    The exact time it will take depends on how quickly your database, so increase the number of zeros for scale at the break you want.

    select max(level)
    from    dual
    connect by level <= 1000000
    
  • Equivalent of Oracle DB record Simple of Transaction in SQL Server mode?

    G ' Day Experts!

    I was wondering not if Oracle DB has the functional equivalent of the 'simple' operation logging available in SQL Server?

    It would be available at the level of the schema, or it should be the entirety of an instance?

    I ask because the WebCenter Interaction portal and related services has no practical use for point-in-time restores. The Portal uses the discrete event borders which unfortunately do not map in the relational world.

    Thank you!
    Rob in Vermont

    Plumtree says:
    G ' Day Experts!

    I was wondering not if Oracle DB has the functional equivalent of the 'simple' operation logging available in SQL Server?

    It would be available at the level of the schema, or it should be the entirety of an instance?

    I ask because the WebCenter Interaction portal and related services has no practical use for point-in-time restores. The Portal uses the discrete event borders which unfortunately do not map in the relational world.

    Thank you!
    Rob in Vermont

    Hi Rob

    I guess that you are referring to the model simple recovery , IE lose everything since the last backup. Oracle, which is equivalent to running a database in NOARCHIVELOG mode. It applies to the database rather than the instance, even if you were intending probably to database when you said instance.

    Niall Litchfield
    http://www.orawin.info/

  • Question about the Type of SQL equivalent Collection Oracle

    (1) I read documentation collections oracle, can I know why the 'STORE AS' clause is used only when creating the table, but not when the object creation?

    Table:

    CREATE TYPE CourseList AS TABLE OF VARCHAR2(64);
    CREATE TABLE department (
      name     VARCHAR2(20),
      director VARCHAR2(20),
      office   VARCHAR2(20),
      courses  CourseList)
      NESTED TABLE courses STORE AS courses_tab;
    

    Object:

    CREATE TYPE CourseList AS TABLE OF VARCHAR2(10)  -- define type
    CREATE TYPE Student AS OBJECT ( -- create object
       id_num  INTEGER(4),
       name    VARCHAR2(25),
       address VARCHAR2(35),
       status CHAR(2),
       courses CourseList)  -- declare nested table as attribute
    

    (2) also can I know what is the difference between OBJECT & RECORD?

    My understanding is that the OBJECT is entity sql where you create and store data in this document, while the RECORDING is PLSQL entity where you group different types of data elements in one?, hope you can give me an example to better understand.

    Thank you.

    Ariean wrote:

    (1) I read documentation collections oracle, can I know why the 'STORE AS' clause is used only when creating the table, but not when the object creation?

    Fix. The column of the course are (similar to an array) collection type. This requires a "nested table" for this column store the list of the values in this column.

    This approach however is an exception to the rule - as it flies in the face of robust and sound design mathematically, relational.

    (2) also can I know what is the difference between OBJECT & RECORD?

    A record is similar to a struct in C/C++. A record contains one or more fields/variables. It's a basic structure for the creation of a 'container of variables' and by the way this container between code units, as oppose to pass individual variables. It is also the basis for the creation of intelligent data structures in structured programming. For example an IP socket structure is a unique smart container consisting of items/variables such as socket, protocol family and type, flags address and so on.

    It is a standard feature in most (if not all) of the structured programming languages - C / C++ and Pascal, Cobol and Visual Basic. PL/SQL is based on the Ada language - and like other members of language (including Pascal), PL/SQL uses the word registration reserve to set a record structure.

    Objects are created in Oracle using the "create or replace type... as object'clause. The correct term is an object oriented class. This differs from a record as a class has data and code. Unlike a record that counts only data.

    Given in a class are called properties. The code of a class is called methods. There are different types of member methods and methods such as the static class constructors, destructive methods.

    Oracle class object is defined using SQL. (Methods) code of this class is set using PL/SQL.

    The classes also supports features like inheritance. Allowing a child class extend the implementation of the parent class. This is not supported by a record structure, beyond a structure that contains another structure as a field attribute. Classes supports the substitution in a child class, the methods of the parent class. As records are composed only of data and not code, there is nothing like ito feature for structures Records.

  • output equivalent $action in oracle

    Hi all

    I am my code of SQL-Server migration to Oracle.

    I'm going to merge statement... I'm able to migrate oracle fusion.

    But I pulled out$ action in SQL server. I don't know the equivalent in oracle.

    Help, please.

    You can use a trigger "after the line insert/update" on the target table. to insert in the tracking table.

    would it not easier to add one or more columns to target on "insert/update", you would think that this information and who introduced data updates, when it could be useful for the audit.

    use one with a trigger for insert/update on the target table connect this info before

    Post edited by: 919871

  • Equivalent DMBS_SQL.to_refcursor in Oracle 10 g

    Hello


    Is there another way to get results like a refcursor in Oracle 10 g with DBMS_SQL? I have the function the function to generate dynamic query and running with DBMS_SQL. This function is called by the code java to display the result in a report. How can I do this, is it equivalent in Oracle 10 g for the DMBS_SQL.to_refcursor? Help, please.

    Thank you

    ilkinesrefli wrote:
    I know there is no way to convert DBMS_SQL result to refcursor in Oracle 10 g, there is no method to_refcursor for DBMS_SQL, but there must be a solution.

    Why should he? Why add new features if they do reproduce existing functionality.

    >

    odie_63 wrote:

    open myRefCursor for 
    using , , ...
    

    It is impossible to use open... for my query method.

    Why?

    I can use only DBMS_SQL.

    Why?

    I need solution to send java code resultset after performance of DBMS_SQL. I do not know collections, temporary tables or other methods can help me or not.

    Are you certain of collections and temporary tables are possible for you?

    You could fill in as an interim step that will slow down your process and select data here, but that will involve using open impossible anyway.

    If you have a variable number of input to the query variables, there are several possible solutions using native dynamic SQL code described here.

    http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:1669972300346534908

  • UNIX_TIMESTAMP and FROM_UNIXTIME from MySQL to ORACLE functions

    Hi all

    I'm migrating some functions and stored procedures in MySQL to ORACLE, and I the next instruction

    Set valuedat = FROM_UNIXTIME (valor + UNIX_TIMESTAMP ('2000-1-01 00:00:00 '));

    Since MySQL.

    Look, I found that:

    UNIX_TIMESTAMP ('2000-1-01 00:00:00 ')

    can be equivalent to the following query:

    SELECT (to_date (January 1, 2000 "," MON-DD-YYYY')-to_date('01-jan-1970','DD-MON-YYYY')) * (86400) as dt FROM dual;

    but testing the numbers is not the same

    Please can someone help me!

    Specifically, I need to know how to build the equivalent in oracle for FROM_UNIXTIME and UNIX_TIMESTAMP functions

    Thank you and best regards!

    CRGM

    Hello

    These are functions that I built to solve the original requirement, thanks for all your comments.

    ************************************************************************************************************************************

    CREATE OR REPLACE FUNCTION FROM_UNIXTIME

    (

    TIMESTAMP_ NUMBER

    ) AS OF DATE OF RETURN

    NUMBER OF SECONDS_PER_DAY: = 86400;

    MASK (50 CHAR) VARCHAR2: = 'DD-Mon-YYYY HH24:MI:SS ";

    DATE OF REF_DATE;

    BEGIN

    REF_DATE: = TO_DATE ('01 - ENE - 1970 00:00:00 ', MASK);

    RETURN REF_DATE + (TIMESTAMP_/SECONDS_PER_DAY);

    END FROM_UNIXTIME;

    **********************************************************************************************************************************

    CREATE OR REPLACE FUNCTION UNIX_TIMESTAMP

    (

    DATE_ IN DATE

    ) RETURN AS NUMBER

    NUMBER OF SECONDS_PER_DAY: = 86400;

    NUMBER OF DIFF_BETWEEN_DATES;

    MASK (50 CHAR) VARCHAR2: = 'DD-Mon-YYYY HH24:MI:SS ";

    DATE OF REF_DATE;

    BEGIN

    REF_DATE: = TO_DATE ('01 - ENE - 1970 00:00:00 ', MASK);

    DIFF_BETWEEN_DATES: = TO_DATE (TO_CHAR (SYS_EXTRACT_UTC (DATE_), MASK), MASK)

    -REF_DATE;

    RETURN DIFF_BETWEEN_DATES * SECONDS_PER_DAY;

    END UNIX_TIMESTAMP;

    ******************************************************************************************************************************

    Concerning

  • equivalent to decode a file replicat

    Hello

    I wanted to know if there is any equivalent to oracle command decode function that can be used in the file replicat. I donot want to modify the source, but interpret it differently in the target system. Help, please

    Thank you

    You can use CASE statement. Let's look at an example in this link.

    http://gavinsoorma.com/2011/08/using-the-GoldenGate-column-conversion-functions-case-and-eval/

  • Can someone do this in Oracle?

    Browse the columns in a given table name of the table.
     
    --In SQL Server 
    select name, system_type_id, max_length, precision, scale, is_nullable from sys.columns 
    where object_name(object_id) = 'PricePlans' 
    
    SOR_ID 167 50 0 0 1 
    PPLAN_CD 167 50 0 0 1 
    PPLAN_MKT_CD 167 50 0 0 1 
    PPLAN_DESC 167 5000 0 0 1 
    I don't know the sys.columns equivalent in Oracle.

    Thank you
    Ken

    You can get the list of the names of columns through views DBA_TAB_COLS, USER_TAB_COLS or ALL_TAB_COLS.

    I hope this helps!

  • Can I call MS Excel function in Oracle

    Hello world

    I have prototyped my application in Microsoft Excel. In this prototype, I use the BETADIST() function, which returns the cumulative beta probability density function. And, Yes, if you're like me and not a statistician, it's pretty crazy. Just for fun, check out the page of wikipedia on this subject, and you'll see what I mean. Anyway, so now I'm doing the same functionality as this function in my Oracle APEX 4.0/Oracle 10 g R2 - app.

    I studied this feature a lot, and I couldn't find a function equivalent to Oracle to do what this function. CUME_DIST... nope, DBMS_STATS_FUNC... No. So, I guess I need to figure out what exactly the function and basically rewirte in Oracle using PL/SQL. I already have questions forums statistics and Excel tries to understand this.

    But, before I go further and reinventing the wheel by coding the logic embedded in this function (which is very hairy, of course), I wanted to check with you all and see if there is a way to call this function in MS Excel by Oracle. Not sure if an outpatient procedure can access an Excel library, or how if he can.

    Any ideas?

    Thank you!
    Mark

    I'm sure that this BETADIST exists in Java.

    I think that not natively.

    But you can download libraries of COLT of Cern for high performance scientific and technical computing in Java.

    Loading libraries by loadjava

    loadjava -user michael/xxxx@oracle_server:1521:oracle_sid -verbose -force -order -resolve -thin colt.jar concurrent.jar
    

    and the creation of a function

    create or replace function betadist (alpha number, beta number, c number)
         return number
      as
         language java
         name 'cern.jet.stat.Gamma.incompleteBeta(double, double, double) return double';
    /
    

    is rather simple.

    The appellant

    SQL> select betadist(4,5,0.4) from dual
    /
    BETADIST(4,5,0.4)
    -----------------
             ,4059136
    1 row selected.
    

    the result coincides fairly well with the example given in the http://www.excelfunctions.net/Excel-Beta-Dist-Function.html.

  • AS with the range (i.e., [] in SQL Server)

    Hello!

    I have a varChar column where I want to select only the records with the digital id column also contains records beginning with the characters A - Z.
    I would use this SQL server syntax (that I tried havn't, but found examples of):

    SELECT *.
    FROM table WHERE
    idColumn LIKE ' [1-9] % ';

    What would be the equivalent in Oracle? If AS command is not applicable, then what to do?

    Best regards
    Paul

    Hello

    It would be something like:

    ... where regexp_like(yourField,'^[0-9]*$');
    

    who uses the regular expression.

    Example:

    SQL> with d as (
      2  select '12345' v from dual
      3  union all
      4  select '123abc456' from dual
      5  union all
      6  select '123***' from dual
      7  )
      8  select *
      9  from d
     10  where regexp_like(v,'^[0-9]*$') ;
    
    V
    ---------
    12345
    
  • Problem while Generating premium no help break statement

    Hello

    I want to create a stored procedure that has an input parameter and it will check and display the entry of prime number
    until the number of 1. also can someone please tell me what is the keyword "break" equivalent in oracle such as used in the other programming language.


    My procedure is like:


    create or repalce procedure premium (newnum in number)
    is
    i the number: = 2;
    number num: = 1;
    Start
    while(newnum>num)
    loop
    while(i<newnum)
    loop
    If mod (newnum, i) = 0
    then
    dbms_output.put_line ('not a premium no');
    break;................................................... Can I use like this?
    end if;
    on the other
    i: = i + 1;
    If I = num
    then
    dbms_output.put_line ('bonus no.' | newnum);
    break;
    end if;
    end loop;
    newnum: = newnum-1;
    end loop;



    can someone plese help me solve this problem.


    Thank you
    Madam.

    Check this box:

    SQL> ed
    Wrote file afiedt.buf
    
      1  DECLARE
      2  v_num NUMBER := &1;
      3  v_prime_flag NUMBER := 0;
      4  BEGIN
      5  FOR I IN 1..v_num LOOP
      6  FOR J IN 2..TRUNC(I/2) LOOP
      7  IF (MOD(I,J) = 0) THEN
      8  v_prime_flag := 1;
      9  EXIT;
     10  END IF;
     11  END LOOP;
     12  CASE (v_prime_flag)
     13  WHEN 0 THEN
     14  DBMS_output.put_line(I ||' is a prime Number');
     15  WHEN 1 THEN
     16  DBMS_output.put_line(I ||' is not a prime Number');
     17  END CASE;
     18  v_prime_flag := 0;
     19  END LOOP;
     20* END;
    SQL> /
    Enter value for 1: 10
    old   2: v_num NUMBER := &1;
    new   2: v_num NUMBER := 10;
    1 is a prime Number
    2 is a prime Number
    3 is a prime Number
    4 is not a prime Number
    5 is a prime Number
    6 is not a prime Number
    7 is a prime Number
    8 is not a prime Number
    9 is not a prime Number
    10 is not a prime Number
    
    PL/SQL procedure successfully completed.
    
    SQL> /
    Enter value for 1: 20
    old   2: v_num NUMBER := &1;
    new   2: v_num NUMBER := 20;
    1 is a prime Number
    2 is a prime Number
    3 is a prime Number
    4 is not a prime Number
    5 is a prime Number
    6 is not a prime Number
    7 is a prime Number
    8 is not a prime Number
    9 is not a prime Number
    10 is not a prime Number
    11 is a prime Number
    12 is not a prime Number
    13 is a prime Number
    14 is not a prime Number
    15 is not a prime Number
    16 is not a prime Number
    17 is a prime Number
    18 is not a prime Number
    19 is a prime Number
    20 is not a prime Number
    
    PL/SQL procedure successfully completed.
    
    SQL> /
    Enter value for 1: 12
    old   2: v_num NUMBER := &1;
    new   2: v_num NUMBER := 12;
    1 is a prime Number
    2 is a prime Number
    3 is a prime Number
    4 is not a prime Number
    5 is a prime Number
    6 is not a prime Number
    7 is a prime Number
    8 is not a prime Number
    9 is not a prime Number
    10 is not a prime Number
    11 is a prime Number
    12 is not a prime Number
    
    PL/SQL procedure successfully completed.
    
  • 3.0 installation / 11g AIA on SOA 10g (10.1.3.4) - OAS

    Is it possible to install 3.0 AIA / 11g in the edition of 10g (10.1.3.4) SOA, if so, please direct me to the installation guides...

    I understand No 11g releases are more weblogic-oriented, so I can't find the 11g installation guides useful.

    Ooookay be more precise, I tried to install AIA 11 g SOA (10.1.3.4) server, the problem is in the third stage where "SOA server details" are given, I am not able to connect to my server SOA.

    These r & d values I gave

    Admin Host Name: mildh0155
    Admin Port: 6003
    Domain name: xxx(i thot this as the instance name,if im wrong pls correct as to which name has to be entered here incase of the OAS)
    Admin User: 0c4jadmin
    Admin password: xxxxxxx

    The "managed server" wait a minute and then becomes "Impossible to connect to the server.

    Pls help... Thanks in advance

    Hi Vincent,.

    You can not install 3.0 AIA on SOA Suite 10 g since AIA 3.0 operates on FCC even components that cannot be deployed on SOA Suite 10 g. The domain name that should AIA 3.0 installation is the domain name of the weblogic server that has no equivalent in Oracle Application server, and port is the port of the weblogic admin server not opmn ask port.

    Hope that answers your query.

Maybe you are looking for