Oracle

Regex101 vs Oracle Regex

流过昼夜 提交于 2021-02-10 21:24:59
问题 My regex: ^\+?(-?)0*([[:digit:]]+,[[:digit:]]+?)0*$ It is removing leading + and leading and tailing 0s in decimal number. I have tested it in regex101 For input: +000099,8420000 and substitution \1\2 it returns 99,842 I want the same result in Oracle database 11g: select REGEXP_REPLACE('+000099,8420000','^\+?(-?)0*([[:digit:]]+,[[:digit:]]+?)0*$','\1\2') from dual; But it returns 99,8420000 (tailing 0s are still present...) What I'm missing? EDIT It works like greedy quantifier * at the end

Regex101 vs Oracle Regex

随声附和 提交于 2021-02-10 21:22:37
问题 My regex: ^\+?(-?)0*([[:digit:]]+,[[:digit:]]+?)0*$ It is removing leading + and leading and tailing 0s in decimal number. I have tested it in regex101 For input: +000099,8420000 and substitution \1\2 it returns 99,842 I want the same result in Oracle database 11g: select REGEXP_REPLACE('+000099,8420000','^\+?(-?)0*([[:digit:]]+,[[:digit:]]+?)0*$','\1\2') from dual; But it returns 99,8420000 (tailing 0s are still present...) What I'm missing? EDIT It works like greedy quantifier * at the end

Regex101 vs Oracle Regex

时光总嘲笑我的痴心妄想 提交于 2021-02-10 21:21:44
问题 My regex: ^\+?(-?)0*([[:digit:]]+,[[:digit:]]+?)0*$ It is removing leading + and leading and tailing 0s in decimal number. I have tested it in regex101 For input: +000099,8420000 and substitution \1\2 it returns 99,842 I want the same result in Oracle database 11g: select REGEXP_REPLACE('+000099,8420000','^\+?(-?)0*([[:digit:]]+,[[:digit:]]+?)0*$','\1\2') from dual; But it returns 99,8420000 (tailing 0s are still present...) What I'm missing? EDIT It works like greedy quantifier * at the end

Listen for Oracle Database changes in .net

痞子三分冷 提交于 2021-02-10 20:45:35
问题 I have a windows service application written in .net 3.5 that needs to know when data is added or modified into an Oracle Database. Currently the service does some awkward bit of polling that is both slow and buggy. 回答1: This might be what you are looking for - Using Database Change Notification With ODP.NET and Oracle Database 11g http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/hol08/dotnet/changenotification/odpnetchg_otn.htm 来源: https://stackoverflow.com/questions/33700319

Listen for Oracle Database changes in .net

我的梦境 提交于 2021-02-10 20:44:06
问题 I have a windows service application written in .net 3.5 that needs to know when data is added or modified into an Oracle Database. Currently the service does some awkward bit of polling that is both slow and buggy. 回答1: This might be what you are looking for - Using Database Change Notification With ODP.NET and Oracle Database 11g http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/hol08/dotnet/changenotification/odpnetchg_otn.htm 来源: https://stackoverflow.com/questions/33700319

Update previous days count using LAG function in ORACLE

[亡魂溺海] 提交于 2021-02-10 20:24:16
问题 I have a table with columns as product, txn_date and no_of_txns. One more column prev_day_txn added recently to the column. Data is something like below: Product TXN_DATE NO_OF_TXNS AA 1-JAN-19 100 AA 2-JAN-19 180 AA 3-JAN-19 290 With the new column added, data in the column should be populated with previous day's data. Output should be something like below: Product TXN_DATE NO_OF_TXNS PREV_DAY_TXN AA 1-JAN-19 100 0 AA 2-JAN-19 180 100 AA 3-JAN-19 290 180 I am trying to update the data using

Update previous days count using LAG function in ORACLE

北城以北 提交于 2021-02-10 20:23:00
问题 I have a table with columns as product, txn_date and no_of_txns. One more column prev_day_txn added recently to the column. Data is something like below: Product TXN_DATE NO_OF_TXNS AA 1-JAN-19 100 AA 2-JAN-19 180 AA 3-JAN-19 290 With the new column added, data in the column should be populated with previous day's data. Output should be something like below: Product TXN_DATE NO_OF_TXNS PREV_DAY_TXN AA 1-JAN-19 100 0 AA 2-JAN-19 180 100 AA 3-JAN-19 290 180 I am trying to update the data using

Oracle - FORCE view option isn't shown on view after executed

三世轮回 提交于 2021-02-10 20:18:44
问题 We created a view for handling complex SQL, But when creating a view using FORCE option. e.g: create or replace FORCE view testview as select 1 from dual; FORCE is removed when viewing the view later create or replace view testview as select 1 from dual; Specify FORCE if you want to create the view regardless of whether the base tables of the view or the referenced object types exist or the owner of the schema containing the view has privileges on them. These conditions must be true before

Oracle 12c - drop table and all associated partitions

你说的曾经没有我的故事 提交于 2021-02-10 18:50:26
问题 I created table t1 in Oracle 12c. Table has data and it is partitioned on list partition and also has subpartitions. Now I want to delete whole table and all associated partitions (and subpartitions). Is this the right command to delete all? DROP TABLE t1 PURGE; 回答1: When you run DROP then the table is removed entirely from database, i.e. the table does not exist anymore. If you just want to remove all data from that table run truncate table T1 drop storage; You can also truncate single (sub-

(转) Oracle性能优化-读懂执行计划

 ̄綄美尐妖づ 提交于 2021-02-10 18:48:29
Oracle的执行计划 得到执行计划的方式 Autotrace例子 使用Explain explain plan set STATEMENT_ID='testplan' for select * from dual; select lpad(' ',5*(level-1))||operation operation, options, object_name, cost,position from plan_table start with id=0 and STATEMENT_ID='testplan' connect by prior id=parent_id ; 怎样看执行计划 看懂执行计划前先需要了解的一些知识 伪列-ROWID rowid是一个伪列,既然是伪列,那么这个列就不是用户定义,而是系统自己给加上的。对每个表都有一个rowid的伪列,但是表中并不物理存储ROWID列的值。不过你可以像使用其它列那样使用它,但是不能删除改列,也不能对该列的值进行修改、插入。一旦一行数据插入数据库,则rowid在该行的生命周期内是唯一的,即即使该行产生行迁移,行的rowid也不会改变。 Recursive SQL 有时为了执行用户发出的一个sql语句,Oracle必须执行一些额外的语句,我们将这些额外的语句称之为‘recursive calls’或‘recursive SQL