oracle10g

Solving the mutating table problem in Oracle SQL produces a deadlock

不羁岁月 提交于 2019-12-01 06:36:47
Hey, I'm trying to create a trigger in my Oracle database that changes all other records except the one that has just been changed and launched the trigger to 0. Because I am updating records in the same table as the one that launched the trigger I got the mutating table error. To solve this, I put the code as an anonymous transaction, however this causes a deadlock. Trigger code: CREATE OR REPLACE TRIGGER check_thumbnail AFTER INSERT OR UPDATE OF thumbnail ON photograph FOR EACH ROW BEGIN IF :new.thumbnail = 1 THEN check_thumbnail_set_others(:new.url); END IF; END; Procedure code: CREATE OR

Recursive query for table dependencies is not recursing not as much as I'd like

邮差的信 提交于 2019-12-01 06:32:27
I had an idea that I could write a query to find all the descendent tables of a root table, based on foreign keys. Query looks like this: select level, lpad(' ', 2 * (level - 1)) || uc.table_name as "TABLE", uc.constraint_name, uc.r_constraint_name from all_constraints uc where uc.constraint_type in ('R', 'P') start with uc.table_name = 'ROOT_TAB' connect by nocycle prior uc.constraint_name = uc.r_constraint_name order by level asc; The results I get look like this: 1 ROOT_TAB XPKROOTTAB 1 ROOT_TAB R_20 XPKPART_TAB 2 CHILD_TAB_1 R_40 XPKROOTTAB 2 CHILD_TAB_2 R_115 XPKROOTTAB 2 CHILD_TAB_3 R_50

What can cause Oracle to ignore an APPEND hint requesting it to perform a direct path load?

ぐ巨炮叔叔 提交于 2019-12-01 06:28:30
问题 I wish to do a serial, logging insert of bulk data from one table to another. This is once-of as part of a data migration so swapping partitions, etc is not an answer. The SQL will be of the following structure: INSERT /*+ APPEND */ ... SELECT FROM .... What might cause Oracle to run this a convential insert rather than a direct path insert? For example, I believe having a trigger on the table will cause Oracle to conduct a convential insert. Is there a definitive list of restrictions? 回答1: A

LISTAGG alternative in Oracle 10g

假装没事ソ 提交于 2019-12-01 06:26:20
I am kind of newbie in Oracle. Got stuck in the below: I have the below 2 tables: Site: **SiteID|SiteName** 1 Sydney 2 Newyork 3 Delhi People: **RecordID|PeopleID|SiteID** 1 1 1 2 1 2 3 2 2 4 3 1 5 3 2 6 3 3 Now in my query I want an output something like this: **PeopleID | AssignedSites** 1 Sydney,NewYork 2 Newyork 3 Sydney,NewYork,Delhi Few more points: -The solution should work in Oracle 10g as well as 11g also. -I have given small subset of data in the above example for brevity.But, in my prod scenario, one Person can be associated with 1000+ locations and there could 1000+ such person, so

Desired output with given table data

混江龙づ霸主 提交于 2019-12-01 06:14:41
问题 Hi I have a table test its structure is given below: **Testing** PK C1 c2 --------------- 1 v11 v12 2 v21 v23 3 v31 v32 Now I need to query this table (testing) such that I get the below output. Pk Key value --------------- 1 c1 v11 1 c1 v12 2 c2 v21 2 c2 v22 3 c3 v31 3 c3 v32 Can this been possible with sql query in Oracle 11g ,Is it possible with PIVOT feature in 11g? 回答1: No, it can't be done with PIVOT , but it can be done with UN PIVOT: SELECT Pk, "Key", value FROM Testing UNPIVOT (

Binding int64 (SQL_BIGINT) as query parameter causes error during execution in Oracle 10g ODBC

大城市里の小女人 提交于 2019-12-01 05:40:23
问题 I've got an insert into a table using ODBC 3.0 on Oracle 10g that is failing and I have no idea why. The database is on Windows Server 2003. The client is on Windows XP. The table: CREATE TABLE test ( testcol NUMBER(20,0) NULL ); The ODBC calls: SQLAllocHandle(SQL_HANDLE_STMT) = SQL_SUCCESS SQLPrepare(INSERT INTO test (testcol) VALUES (?);) = SQL_SUCCESS SQLINTEGER nStrLen = 0; __int64 nInt64 = 99; SQLBindParameter(hStatement, 1, SQL_PARAM_INPUT, SQL_C_SBIGINT, SQL_BIGINT, 20, 0, &nInt64, 0,

how to store BigInteger values in oracle database

拈花ヽ惹草 提交于 2019-12-01 05:25:46
I have connected Java program to Oracle database using JDBC. I want to store BigInteger values(512 bits) in the database. What should be the type of the column? I m trying like this: I have taken a column of number type in the database. I converted BigInteger to BigDecimal like this: BigInteger b=new BigInteger("5779857570957802579079"); Number n =b; BigDecimal d=(BigDecimal)n; PreparedStatement pstmt=con.prepareStatemant("insert into database values(?,?)"); pstmt.setString(1,"john"); pstmt.setBigDecimal(2,d); I am getting the following exception: javax.servlet.ServletException: java.lang

Recursive query for table dependencies is not recursing not as much as I'd like

霸气de小男生 提交于 2019-12-01 04:48:04
问题 I had an idea that I could write a query to find all the descendent tables of a root table, based on foreign keys. Query looks like this: select level, lpad(' ', 2 * (level - 1)) || uc.table_name as "TABLE", uc.constraint_name, uc.r_constraint_name from all_constraints uc where uc.constraint_type in ('R', 'P') start with uc.table_name = 'ROOT_TAB' connect by nocycle prior uc.constraint_name = uc.r_constraint_name order by level asc; The results I get look like this: 1 ROOT_TAB XPKROOTTAB 1

Solving the mutating table problem in Oracle SQL produces a deadlock

我的未来我决定 提交于 2019-12-01 04:17:54
问题 Hey, I'm trying to create a trigger in my Oracle database that changes all other records except the one that has just been changed and launched the trigger to 0. Because I am updating records in the same table as the one that launched the trigger I got the mutating table error. To solve this, I put the code as an anonymous transaction, however this causes a deadlock. Trigger code: CREATE OR REPLACE TRIGGER check_thumbnail AFTER INSERT OR UPDATE OF thumbnail ON photograph FOR EACH ROW BEGIN IF

how to store BigInteger values in oracle database

て烟熏妆下的殇ゞ 提交于 2019-12-01 04:05:15
问题 I have connected Java program to Oracle database using JDBC. I want to store BigInteger values(512 bits) in the database. What should be the type of the column? I m trying like this: I have taken a column of number type in the database. I converted BigInteger to BigDecimal like this: BigInteger b=new BigInteger("5779857570957802579079"); Number n =b; BigDecimal d=(BigDecimal)n; PreparedStatement pstmt=con.prepareStatemant("insert into database values(?,?)"); pstmt.setString(1,"john"); pstmt