oracle11g

Record events if values have changed in the last 3 days

亡梦爱人 提交于 2020-03-24 01:20:31
问题 I have a question, I have a table of importance. But the difference between these values is 3 days. select er.name, er.temp as real_temp, der.temp as old_temp from TEMPR_SILO er left join TEMPR_SILO der on er.name = der.name where der.ID_TRANS in (select max(ID_TRANS) - 72 from TEMPR_SILO) and er.ID_TRANS in (select max(ID_TRANS) from TEMPR_SILO) My answer NAME REAL_TEMP OLD_TEMP SENSOR0001 7.98 9.66 SENSOR0002 8.04 9.91 SENSOR0003 7.91 0.41 SENSOR0004 9.54 -0.27 SENSOR0005 9.85 -1.09

Using a case statement in a check constraint

青春壹個敷衍的年華 提交于 2020-02-28 07:00:23
问题 i'v been learning SQL for the last week but I am unsure how to correctly add a case statement within a check constraint. Can anybody give me any pointers? I have the following grade table: CREATE TABLE Grade ( salary_grade char(1) NOT NULL CHECK (salary_grade = UPPER(salary_grade)), CONSTRAINT ck_grade_scale CHECK( CASE WHEN salary_grade = '[A-D]' THEN salary_scale = 'S1' WHEN salary_grade = '[D-G]' THEN salary_scale = 'S2' END) salary_scale char(2) DEFAULT 'S1' NOT NULL, CONSTRAINT pk_grade

Setting fetch size in entity framework

流过昼夜 提交于 2020-02-24 11:15:29
问题 I am converting ado.net code to use EF. In my ado.net code i set dataReader.FetchSize = command.RowSize * 1000 and that dramatically improves performance over the default fetch size . When I convert my code to EF, the performance is on par to ado.net code where I didn't specify fetch size, i.e. it's very slow over large records. Any way I could specify fetch size for retrieving records in EF? 回答1: You can set ODP.NET FetchSize in the Registry or the .NET config files when using Entity

Issue in running a Proc - Oracle PL/SQL

牧云@^-^@ 提交于 2020-02-23 04:19:24
问题 I created a proc in Oracle db from a sql query as below:- CREATE OR REPLACE PROCEDURE getTableDetails( p_tablename IN table_info.table_name%TYPE, o_owner OUT table_info.owner%TYPE, o_table_name OUT table_info.table_name%TYPE, o_num_rows OUT table_info.num_rows%TYPE, o_num_cols OUT table_info.num_cols%TYPE, o_columnlist OUT table_info.columnlist%TYPE, o_keycolumns OUT table_info.keycolumns%TYPE, ) IS BEGIN with tableinfo as (select t.owner, t.table_name, t.num_rows, count(*) as num_cols,

ORA-29913: error in executing ODCIEXTTABLEOPEN callout

陌路散爱 提交于 2020-02-06 09:58:07
问题 I am creating external table using hr schema but i get errors "ORA-29913: error in executing ODCIEXTTABLEOPEN callout ORA-29400: data cartridge error KUP-00554: error encountered while parsing access parameters KUP-01005: syntax error: found "missing": expecting one of: "column, (" KUP-01007: at line 4 column 3 29913. 00000 - "error in executing %s callout" *Cause: The execution of the specified callout caused an error. *Action: Examine the error messages take appropriate action." -----------

Oracle XMLQuery is corrupting the namespace

本秂侑毒 提交于 2020-02-04 04:51:51
问题 Oracle version 11.2 Below is a cut down version of an XMLQuery i'm running on an XMLType column. When I run the query, which simply parses and recreates the stored XML, the tsxm namespace ( that is not equal to the default namespace ) gets changed. This query does nothing and could easily be rewritten, but the real (much bigger) query uses this same methodology so this is why i'm posting the question in this format. If I change the tsxm namespace definition to be the same as the default

Oracle XMLQuery is corrupting the namespace

こ雲淡風輕ζ 提交于 2020-02-04 04:51:35
问题 Oracle version 11.2 Below is a cut down version of an XMLQuery i'm running on an XMLType column. When I run the query, which simply parses and recreates the stored XML, the tsxm namespace ( that is not equal to the default namespace ) gets changed. This query does nothing and could easily be rewritten, but the real (much bigger) query uses this same methodology so this is why i'm posting the question in this format. If I change the tsxm namespace definition to be the same as the default

Oracle regexp_replace on complete words

旧城冷巷雨未停 提交于 2020-02-03 09:32:26
问题 I want to replace instances of the word OF with "OF". I only want this to work on complete words. So not on L_OF, DOF, OFZ, DOFD, OF_L, etc. My code works below except for the final string. It returns: ("OF"*OF + 2) ... instead of: ("OF"*"OF" + 2) How can I get it to work on that one as well? with stg as ( select '(ofof+ol)' str from dual union all select '(oof+ol+of)' from dual union all select '(*of + 2)' from dual union all select '(of*of + 2)' from dual ) select str, regexp_replace(upper

How to get the values for the next and next next date in a table

孤者浪人 提交于 2020-02-02 17:44:59
问题 We have a table with columns Effective_Date, CVal,CPrice How do we query the table to return values from these 2 rows in 1 row: CVal (NextVal) and CPrice (NextPrice) values from row with Effective_Date the next date after somedate CVal (SecondVal) and CPrice (SecondPrice) values from row with Effective_Date the next date after the Effective_Date from #1 For ex: Effective_Date CVal CPrice 01-JAN-19 1 100 01-JAN-20 2 101 01-JAN-21 3 102 01-JAN-22 4 103 Say somedate = '31-DEC-19' Expected result

Oracle 11g: In PL/SQL is there any way to get info about inserted and updated rows after MERGE DML statement?

孤街醉人 提交于 2020-02-02 13:22:40
问题 I would like to know is there any way to receive information in PL/SQL how many rows have been updated and how many rows have been inserted while my PL/SQL script using MERGE DML statement. Let's use Oracle example of merge described here: MERGE example This functionality is used in my function but also I'd like to log information how many rows has beed updated and how many rows have been inserted. 回答1: There is a not a built-in way to get separate insert and update counts, no. SQL%ROWCOUNT