oracle11g

How to reduce code duplication caused by substring and instring?

不打扰是莪最后的温柔 提交于 2019-12-21 06:55:23
问题 I need to parse a text field (Description), delimited by '\n', into three separate fields. I am doing this by utilizing substr and instr , but it results in difficult to read and repetitive sql. Is there a way to create and use a variable or expression to hold the "position" value returned by the instring function so I can pass that variable to substr instead? My code posted below functions and returns the correct results, but it doesn't feel right. There's a lot of duplication. Relevant Raw

Getting error while trying to alter table in an sql block

梦想的初衷 提交于 2019-12-21 06:48:54
问题 I create a test.sql file and inside I put: begin alter table table1 enable row movement; alter table table1 shrink space; end; / Is this not allowed? Because I get error: Encountered the symbol "ALTER" when expecting one of the following: begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << close current delete fetch lock insert open rollback savepoint set sql execute commit

How to find the column used in the dynamic query without executing whole query

微笑、不失礼 提交于 2019-12-21 06:48:33
问题 Problem Statement I have a dynamic SQL which i need to store in a table ,but before storing the sql i need to validate the sql with the list of columns stored in another table. Without executing the query , is it possible to find name of columns in the select ? Approach1 Only option i can think of is ,try to use explain plan of the query and read the meta data in the data dictionaries table .But unfortunately i am not able to find any table with such data.Please let me know if you know such

How to spread the average between two intervals in oracle

纵然是瞬间 提交于 2019-12-21 06:01:08
问题 If given the Average for 24 hours for each date in a year. I want to spread this hourly average to average at each minute. e.g. given Date Time Average 01-Jan-15 23:00 20 02-Jan-15 00:00 50 02-Jan-15 01:00 30 I want the output to be calculated something as below .... DateTime AVG_VALUE 01/01/2015 23:00:00 20 01/01/2015 23:01:00 20.5 01/01/2015 23:02:00 21 01/01/2015 23:03:00 21.5 01/01/2015 23:04:00 22 01/01/2015 23:05:00 22.5 01/01/2015 23:06:00 23 01/01/2015 23:07:00 23.5 01/01/2015 23:08

How to solve : SQL Error: ORA-00604: error occurred at recursive SQL level 1

天涯浪子 提交于 2019-12-21 05:18:08
问题 When I'm trying to drop table then I'm getting error SQL Error: ORA-00604: error occurred at recursive SQL level 2 ORA-01422: exact fetch returns more than requested number of rows 00604. 00000 - "error occurred at recursive SQL level %s" *Cause: An error occurred while processing a recursive SQL statement (a statement applying to internal dictionary tables). *Action: If the situation described in the next error on the stack can be corrected, do so; otherwise contact Oracle Support. 回答1: One

What is the purpose of logging/nologging option in Oracle

那年仲夏 提交于 2019-12-21 04:53:20
问题 What happens if I don't specify logging/nologging in database objects in Oracle? What I meant to say how would behave with logging/nologging in database objects and without logging/nologging in database objects? 回答1: LOGGING/NOLOGGING helps manage enabling direct path writes in order to reduce the generation of REDO and UNDO. It is one of several ways to control the delicate balance between recoverability and performance. Oracle Architecture Background Information REDO is how Oracle provides

What is the purpose of logging/nologging option in Oracle

大兔子大兔子 提交于 2019-12-21 04:53:08
问题 What happens if I don't specify logging/nologging in database objects in Oracle? What I meant to say how would behave with logging/nologging in database objects and without logging/nologging in database objects? 回答1: LOGGING/NOLOGGING helps manage enabling direct path writes in order to reduce the generation of REDO and UNDO. It is one of several ways to control the delicate balance between recoverability and performance. Oracle Architecture Background Information REDO is how Oracle provides

PL/SQL: ORA-00942: table or view does not exist V$SQL

霸气de小男生 提交于 2019-12-21 04:27:34
问题 I have created a procedure and used the below statement inside that . select sql_id into v_sql_id from v_$sql where sql_text =v_sql; I am getting the following error PL/SQL: ORA-00942: table or view does not exist I have checked the synonym its owner is PUBLIC ,so it should run in this case ,but its not working . Another thing i can select sql_id from v_$sql where sql_text =v_sql; this in simple editor .Can anyone help me with this . 回答1: Database dictionary related or system tables (v_$sql

OracleConnection.Open is throwing ORA-12541 TNS no listener

给你一囗甜甜゛ 提交于 2019-12-21 04:25:28
问题 So I am connecting to an external server through C#. I just installed Oracle 11g client on my machine from here: http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html (255MB one). After reading many blogs/questions I found this article to be useful: http://dbaspot.com/oracle-faq/444787-ora-12541-tns-no-listener.html So is this correct? I cannot do anything. The DBA has to edit the LISTENER.ORA file? My tnsnames.ora looks like this: TestingConnect= (DESCRIPTION =

Will Oracle lock the whole table while performing a DML statement or just the row

旧巷老猫 提交于 2019-12-21 03:56:12
问题 When i try to insert/update something in a db table, will Oracle lock the whole table or only the row being inserted/updated? Is this something that can be controlled through external configuration? 回答1: We can issue locks explicitly with the LOCK TABLE command. Find out more Otherwise, an insert does not lock any other rows. Because of Oracle's read isolation model that row only exists in our session until we commit it, so nobody else can do anything with it. Find out more. An update