Oracle equivalent for OBJECTPROPERTY
Hi Friends,
I want the oracle equivalent for the following sql code,
Select @Command = 'IF OBJECTPROPERTY(object_id('''+ @TableName + '''), ''TableHasForeignRef'') = 1
DELETE FROM ' + @TableName + '
ELSE
TRUNCATE TABLE ' + @TableName
EXEC sp_MSForEachTable @CommandI have tried to find out, but no use. Please help me.
Thanks,
Ram.
Ram wrote:
I have tested a table which has foreign key. But the count returned from the query is 0.
Have I implemented your query in the right way?Same like in SQL Server, Oracle does not allow truncating table if it has a PK or UK which is referenced by FK. There are no issues truncating table with FK. Again, it is table with PK/UK where you might not be able to truncate if that PK/UK is referenced by FK. And SQL Server property TableHasForeignRef = TRUE means there is a FK (on a different table or maybe even on same table if it is self-referencing FK) which is referencing PK/UK on a table in question. Query I suggested returns 1 if table has a PK or UK which is referenced by FK. Otherwise it returns 0. So if, in your case, table MY_TABLE owned by user DBO_XYZ has just FK, 0 is correct and you can truncate it. If it would return 1, you would not be able to truncate and would have to delete.
SY.
Similar Messages
-
Oracle equivalent for MS Sql Server WITH(NOLOCK)
Hi all :-)
What is the equivalent of MS Sql Server WITH(NOLOCK)
hint in Oracle ... or ... how can I achieve the same
effect in Oracle SELECT queries ?= dirty read .
to the op : read the concepts guide before going further; Oracle implements a different concurrency model than SQL Server -
Oracle equivalent for temp table variable
Can anyone help me regarding this..
sample code
declare @temptable table (fldcaptioncode bigint, fldrownumber bigint identity (1,1))
i have declaration in sqlserver stored procedure,
Is there any equivalent in oracle 10g
Thanks in advance
Regards
AriffAriff,
temporary tables are supported by Oracle, and SQL Developer uses this feature.
The DDL of the temporary table is extracted and generated as a standalone object.
Please check docs, since there are several examples and informations about tem tables. Docs are available at
http://download.oracle.com/docs/cd/E12151_01/index.htm
or
http://www.oracle.com/technology/tech/migration//workbench/index_sqldev_omwb.html
Thanks
Regards,
MGILIBER -
Oracle equivalent for @@minuserid and @@maxuserid
im migrating from sybase to oracle,.. and in some stored procedure this 2 global parameters are use:
@@minuserid: min. user id
@@maxuserid: maximum user id
is there any equivalent in oracle 10g??No, there isn't.
What are you trying to do with @@minuserid and @@maxuserid?
Maybe we can think about coding around. -
Looking for the oracle equivalent of T-SQL 'SELECT TOP n'
Hi,
I'm looking for the Oracle equivalent of T-SQL 'SELECT TOP n'
and can't find any. There is SAMPLE(n) function but it supposed
to pick up random values and I'm not sure if it's possible to
make it select top values. Please help 8-)
ThanxHi Marina.
Oracle does not have a functionality like SQL Server for TOP
selection. The ROWNUM option should be used with great care and
you may get unreliable results.
Try looking at Metalink
Doc ID: 291065.999
Doc ID: 267329.999
- They discuss this issue, and solutions. -
11g equivalent for the oracle bpm 10g global interactive
Hi,
What is the 11g equivalent for the oracle bpm 10g global interactive activity?
Thansk!The Initiator Task is the 11g equivalent to Global Interactive Activity.
Find more information here
http://download.oracle.com/docs/cd/E14571_01/doc.1111/e15176/human_task_bpmpd.htm
and here
http://jamessmith73.wordpress.com/oracle-soa-bpm-11g/simple-bpm-task-initiator/ -
Oracle equivalent relation terms for History Notes and Abbreviation
Hi,
We are trying to migrate from Basis 9 database to Oracle 10g. The biggest challenge isto build a oracle thesaurus similar to the one in Basis.
In Basis we have relations History Notes(HN) and Abbreviation(AB). I am not able to find equivalent relation in Oracle. Recently I got the ANSI Z39.19 Guidelines document from one of the forum contributor, which mentions about the relations History Notes and Abbreviation. I am not able to load the relation HN. ctxload is stopping at this term with the error DRG-11706: invalid relation HN.
Does anyone know if there is any equivalent relation in Oracle Thesaurus for HN and AB?
ThanksThanks so much for the answers.
Auto Lexer is a indexing element, which I could use for a column. I need abbreviations stored in my system schema so that multiple database instances could access these thesaurus terms. Please correct me if I am wrong.
I thought of the same solution for HN Brian. I am thinking of putting a tag HN to identify them later for display. Abbreviations are more specific and SYN could be general to a term. If I substitute AB with SYN, I am afraid I will loose the data collected by users over the years. I am thinking of putting them in the dr$ths_fphrase table as AB:. The constraint I have here is, thesaurus management tool that comes with Oracle 10g considers all the terms in this table, as terms in different thesaurus. I have changed the code to handle it but I am not sure if I am deviating from the standard practice.
Your feedback on this is much appreciated.
Thanks again -
Any equivalent for "Oracle9i Database: Seminar Series for Oracle Server"?
Dear all
I'm interesting on the Oracle course named "Oracle9i Database: Seminar Series for Oracle Server" - [D16665GC10|http://education.oracle.co.uk/html/oracle/68US/D16665GC10.htm]
AFAIK as Oracle 9i is unsupported, I don't belive that I can find this course available anywhere. So my question is: "Is there any equivalent for above course for 10g/11g?"
Thanks in advanceKamran Agayev A. wrote:
Dear all
I'm interesting on the Oracle course named "Oracle9i Database: Seminar Series for Oracle Server" - [D16665GC10|http://education.oracle.co.uk/html/oracle/68US/D16665GC10.htm]
AFAIK as Oracle 9i is unsupported, I don't belive that I can find this course available anywhere. So my question is: "Is there any equivalent for above course for 10g/11g?" Yes, those are excellent materials. A lot of the material is covered in the DBA 1 & 2 courses, but not as focused and not as 'in depth'. I encourage that you write directly to Oracle University and ask them to upgrade the seminar. (Tell them I'd be happy to update/deliver it. ;-))
An alternative, and possibly even better, is to watch for (or ask for) a local presentation by Jonathan Lewis and/or Cary Millsap (Method R)
/Hans -
What is the equivalent Oracle datatype for the access Memo type?
Hi,
I would like to know what the oracle equivalent of the Access Memo datatype is.
Thanks
AdamYep. Look at this example:
SQL>create table x(y clob);
Table created.
SQL>insert into x values (
2 'This is a very long string
3 and that was an carriage return - entered in notepad'
4 )
5 /
1 row created.
SQL>select * from x;
Y
This is a very long string
and that was an carriage return - entered in notepad
SQL> -
What is the Oracle equivalent of the Microsoft Access FIRST function?
Using: Oracle 10gR2 RAC on SUSE Linux 9 (10.2.0.3)
In the process of converting a Microsoft Access database to Oracle, an Access query is using the FIRST function.
What is the Oracle equivalent of the Microsoft Access FIRST function?
In the attempt to convert, the Oracle FIRST_VALUE function was used. However, the same results was not achieved.
Thanks,
(BLL)
Query:
h2. ACCESS:
SELECT
TRE.GCUSNO,
UCASE([DCUSNO]) AS DCUSNO_STD,
*FIRST(UCASE([DNAME])) AS DNAME_STD*,
*FIRST(UCASE([DADDR])) AS DADDR_STD*,
*FIRST(UCASE([DCITY])) AS DCITY_STD*,
TRE.DSTATE,
FIRST(TRE.DZIP) AS DZIP,
TRE.DREGN,
TRE.DDIST,
TRE.DSLSMN,
TRE.DCHAIN,
TRE.MARKET,
TRE.MKTPGM,
TRE.EUMKT
FROM
TRE
GROUP BY
TRE.GCUSNO,
UCASE([DCUSNO]),
TRE.DSTATE,
TRE.DREGN,
TRE.DDIST,
TRE.DSLSMN,
TRE.DCHAIN,
TRE.MARKET,
TRE.MKTPGM,
TRE.EUMKT;
h2. ORACLE:
SELECT DISTINCT
TRE.GCUSNO,
UPPER(TRIM(TRE.DCUSNO)) AS DCUSNO_STD,
UPPER(TRIM(TRE.DNAME)) AS DNAME_STD,
UPPER(TRIM(TRE.DADDR)) AS DADDR_STD,
FIRST_VALUE(UPPER(TRIM(TRE.DNAME)) IGNORE NULLS) OVER (ORDER BY TRE.GCUSNO) AS DNAME_STD,
FIRST_VALUE(UPPER(TRIM(TRE.DADDR)) IGNORE NULLS) OVER (ORDER BY TRE.GCUSNO) AS DADDR_STD,
FIRST_VALUE(UPPER(TRIM(TRE.DCITY)) IGNORE NULLS) OVER (ORDER BY TRE.GCUSNO) AS DCITY_STD,
TRE.DSTATE,
TRE.DZIP,
FIRST_VALUE(UPPER(TRIM(TRE.DZIP)) IGNORE NULLS) OVER (ORDER BY TRE.DZIP ASC) AS DZIP,
TRE.DREGN,
TRE.DDIST,
TRE.DSLSMN,
TRE.DCHAIN,
TRE.MARKET,
TRE.MKTPGM,
TRE.EUMKT
FROM CRM.TREUP100R TRE
GROUP BY
TRE.GCUSNO,
UPPER(TRIM(TRE.DCUSNO)),
TRE.DNAME,
TRE.DADDR,
TRE.DCITY,
TRE.DSTATE,
TRE.DZIP,
TRE.DREGN,
TRE.DDIST,
TRE.DSLSMN,
TRE.DCHAIN,
TRE.MARKET,
TRE.MKTPGM,
TRE.EUMKT;A slight correction to odie's post. I think you want min not max to replicate the Access first function, but see below to be sure. So:
min(upper(trim(tre.dname))) keep (dense_rank first order by tre.gcusno) as dname_std
user10860953 wrote:How does one ignore null values?The min and max functions will ignore nulls automatically, so if there is a null value in tre.dname, it will not be be returned, unless all of the values are null. For example:
SQL> WITH t AS (
2 SELECT 65 id, 'ABCD' col FROM dual UNION ALL
3 SELECT 37, 'DEFG' FROM dual UNION ALL
4 SELECT 65, 'DEFG' FROM dual UNION ALL
5 SELECT 65, null FROM dual UNION ALL
6 SELECT 70, null FROM dual UNION ALL
7 SELECT 70, null FROM dual UNION ALL
8 SELECT 37, 'ABC' from dual)
9 SELECT id,
10 MIN(col) keep (DENSE_RANK FIRST ORDER BY id) min_dname_std,
11 MAX(col) keep (DENSE_RANK FIRST ORDER BY id) max_dname_std
12 FROM t
13 GROUP BY id;
ID MIN_ MAX_
37 ABC DEFG
65 ABCD DEFG
70John -
Oracle equivalent of MySql commands and code.
Hi,
Does anyone know the Oracle equivalent of the following? I'm not a DBA and my DBA doesn't know MySQL. TIA
Assign access rights: login as root user to mysql:
mysql -uroot -pYourSecretPassword
On some MySQL installations, the root user has no password, in that case drop
the -p parameter.
Then grant the necessary access rights using the following commands: (this will
automatically create the users)
GRANT ALL ON daisyrepository.* TO daisy@"%" IDENTIFIED BY "daisy";
GRANT ALL ON daisyrepository.* TO daisy@localhost IDENTIFIED BY "daisy";
(The localhost entries are necessary because otherwise the default access rights
for anonymous users @localhost will take precedence.)
and create the database using:
CREATE DATABASE daisyrepository;
jackGRANT ALL ON daisyrepository.* TO daisy@% IDENTIFIED
BY "daisy";This means:
GRANT ALL privileges
ON all tables and views in schema 'daisyrepository'
To user daisy from any host.
There are several problems in translation to Oracle:
1) Oracle has a few more privs than MySQL, in part because there are a few more object types. You need to be more restrictive than 'GRANT ALL';
2) Oracle does not support wild cards or patterns grants against a schema's objects. You need to specify each object individually;
3) Oracle users are database users, not host users, so daisy@% does not make any sense at all. You specify the database user name, or perhaps group users into roles and specify the role name.
This is discussed in the SQL Reference manual, in the 'GRANT' chapter, for each version of the database. The docs are at http://docs.oracle.com
Have fun :-p -
Oracle equivalent of...
What is the oracle equivalent of a sql datatype bigint as an IDENTITY column with identity seed 1 and identity increment 1. I am very new to oracle so I am using TOAD to create this table. So im just looking for a KEY field such as an ID field that just creates its own number every time data is entered into any column.
Kind of like ACCESS's autonumber field. Where or what datatype in TOAD do I select for this and tell it that it should automatically create the next ID number.
For example I insert 4 rows
"Jon"
"Bob"
"Steve"
"Mark"
The result in the table should be:
1 Jon
2 Bob
3 Steve
4 Mark
(the numbers are automatic)...If I delete steve then it becomes
1 Jon
2 Bob
4 Mark
(gaps are of course OK since this is just an identity column).
Thanks,
Jon
PS: Is there a way toi change my oracle forum password ? I cant seem to find that either.You can use a sequence and insert it in a trigger :
TEST@db102 SQL> create sequence test_seq nocache;
Sequence created.
TEST@db102 SQL> create table test(c1 number not null , c2 varchar2(50));
Table created.
TEST@db102 SQL> create or replace trigger test_trig
2 before insert on test
3 for each row
4 begin
5 select test_seq.nextval into :new.c1 from dual;
6* end;
TEST@db102 SQL> /
Trigger created.
TEST@db102 SQL> insert into test(c2) values('Jon');
1 row created.
TEST@db102 SQL> insert into test(c2) values('Bob');
1 row created.
TEST@db102 SQL> insert into test(c2) values('Steve');
1 row created.
TEST@db102 SQL> insert into test(c2) values('Mark');
1 row created.
TEST@db102 SQL> select * from test;
C1 C2
1 Jon
2 Bob
3 Steve
4 Mark
TEST@db102 SQL> -
Oracle equivalent of SQL IDENTITY Column
Is there an Oracle equivalent of the MS SQL and Sybase IDENTITY column that creates an automatically incrementing number for each row added?
Thanks in advance.
Andy Llewellyn
[email protected]Oracle has what's called a sequence but it's not actually a column in a table. It's a database object that generates
a sequential number. Here's a simple example of how it works. You can look in the manual for more information.
SQL> create sequence tt start with 1 nocache;
Sequence created.
SQL> create table test(c1 varchar2(1),c2 number);
Table created.
SQL> insert into test values('A',tt.nextval);
1 row created.
SQL> /
1 row created.
SQL> commit;
Commit complete.
SQL> select * from test;
C C2
A 1
A 2 -
Dear All,
I want to fetch any 5 records from a table without using internal table.Basically I want an abap equivalent for the 'rownum' keyword in oracle.
For e.g.
select * from emp where rownum < 5.
How can this be done in abap?
Yours truly,
RatishHi,
you can use Select * upto 5 rows
from mara into wa_mara
where <condition>
end select.
Regards,
Sarath J -
Oracle equivalent of DECRYPT_CHAR() in DB2
Dear All,
We are working in a migration project. We are migrating ODI interfaces from DB2 to Oracle.
The function DECRYPT_CHAR() is used in one of the procedure script. I could not able to find oracle equivalent of DECRYPT_CHAR() function.
Could you anyone please provide any pointers on this.
Thanks a lot in advance.Hi,
As per my experience, there is NO direct function reside for this in Oracle, rather it has inbuild packages to do decryption and encryption but still you need to create a user defined function in your schema.
Thanks,
Guru
Maybe you are looking for
-
Extend Wily Introscope in Solution Manager
Hello, Could I monitor other non SAP solutions in Solution Manager? I need to integrate all systems that are intended for monitoring (SAP and non SAP systems) to Solution Manager What is the scope of Wily Introscope in Solution Manager? Is the scope
-
Where do the current iMac G5 iSights come from?
Anyone buy an iMac G5 online from the Apple store in the month of December? Where did yours ship from (origination)? ie: Shanghai, Elk Grove, Kentucky If you ordered the wired keyboard instead of Bluetooth keyboard model G5 iSight, what is the suffix
-
Can't Install iTunes 10.3.1 on Windows 7
When I try to install itunes on Windows 7, I recieve an error message that says "Could not access network location %APPDATA%". I followed all the apple support troubleshooting advice but still haven't been able to install it.
-
Working with a LifeDrive and a Visor Prism
What palm desktop software, or third party, will work and hotsync with both the LifeDrive and a Visor Prism? I have and will be using both. I currently have 6.2 installed and of course it will not recognize the visor prism. I've tried to research
-
How can I get into itunes? This only happens for one user account ..itunes works on othr user accounts on the same computer.