oracle10g

Create date from year, month and day

。_饼干妹妹 提交于 2019-12-23 16:41:22
问题 Does Oracle have a builtin function to create a date from its individual components (year, month and day) that just returns false on missing data? I'm aware of TO_DATE() but I need to compose a string first and neither the || operator nor the CONCAT() function make it easy to handle missing data: -- my_year NUMBER(4,0) NULL SELECT TO_DATE(my_year || '-01-01', 'YYYY-MM-DD') AS my_date FROM my_table; Whenever my_year is NULL we end up with TO_DATE('-01-01', 'YYYY-MM-DD') and: ORA-01841: (full)

Oracle: How to detect client process termination like it works for sqlplus?

我们两清 提交于 2019-12-23 15:40:18
问题 I have the following problem in my application which connects to an Oracle 10g database: When my client crashes, or the process is terminated via task manager, or the client loses connection for a while, the appropriate entry in the v$session view remains. Now when I connect to the database with sqlplus, and i kill sqlplus.exe through the task manager, the session entry gets deleted almost instantly. Latter behaviour would be preferred for my application for various reasons. What does sqlplus

Get list of arguments with default value

天涯浪子 提交于 2019-12-23 15:16:00
问题 I use ALL_ARGUMENTS to get list of arguments in oracle 10g, but I can't find out is there default value for argument. Haw can I do it? 回答1: you might need to resort to plsql programming in 10g, in the vein of the code sample below. this solution is certainly brute-force in some sense, as you basically write part of a function/procedure declaration parser using very low-level primitives. however, regular expression functions aren't available in 10g either ... the gist of the code is: iterate

maxTimeout value from Machine.Config is not picked up by C# winform app

China☆狼群 提交于 2019-12-23 13:11:17
问题 I have been working on a winform app with Oracle 10g database which is using TransactionScope and wanted to modify the maxTimeOut value specified in machine.config file, my machine.config file is in the following location (I am using .net 4 for this app) C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config Originally there was not anything specified for maxTimeOut in it, therefore it defaults to 10 minutes. In order to change it I have added the maxTimeout="00:00:10" value as seen below:

How can I determine if an Oracle table has the ROWDEPENDENCIES option set?

耗尽温柔 提交于 2019-12-23 13:04:38
问题 I only have the basic Oracle tools available, i.e. SQL Plus, and I need to find out if a table was created with the ROWDEPENDENCIES option. It's a 10g database. And, if it isn't set, can I use ALTER TABLE to set it, or do I have to drop and re-create the table? 回答1: SELECT owner, table_name, dependencies FROM dba_tables; This will return "ENABLED" or "DISABLED" for each table. You cannot change this after the table has been created, so you'll have to re-create the table to set it on. 来源:

Oracle: pivot (coalesce) some counts onto a single row?

大城市里の小女人 提交于 2019-12-23 12:12:38
问题 update: what I was calling coalesce I should have been calling pivot . I'm extracting some daily usage counts from a log table. I can easily get this data one row per date/item, but I would like to pivot coalesce the columns into a single row. e.g., I have: date item-to-be-counted count-of-item 10/1 foo 23 10/1 bar 45 10/2 foo 67 10/2 bar 89 I want: date count-of-foo count-of-bar 10/1 23 45 10/2 67 89 Here's my current 10g query. select trunc(started,'HH'),depot,count(*) from logstats group

Oracle Procedure error (PLS-00428)

半城伤御伤魂 提交于 2019-12-23 11:46:45
问题 This is the error message: PLS-00428: an INTO clause is expected in this SELECT statement. Meanwhile, this is the procedure for testing displaying the system date: CREATE OR REPLACE PROCEDURE "TEST_PROCEDURE" AS BEGIN SELECT SYSDATE FROM DUAL; END; In the first place I don't need to use that INTO Oracle is insisting for me to do. Is there other way around beside using a cursor (I've seen it here https://stackoverflow.com/a/6029963/1983024)? I think it should not be like that, this does run

Is it possible to use sql%rowcount for SELECT?

依然范特西╮ 提交于 2019-12-23 09:04:25
问题 The code below may return more than one row. Will sql%rowcount return the number of rows fetched? select * from emp where empname = 'Justin' and dept='IT' if sql%rowcount>0 ... This is my sample proc; am I using sql%rowcount in correct way? CREATE PROCEDURE Procn(in_Hid IN VARCHAR2,outInststatus OUT VARCHAR2,outSockid IN NUMBER,outport OUT VARCHAR2,outIP OUT VARCHAR2,outretvalue OUT NUMBER) AS BEGIN select INST_STATUS into outInststatus from TINST_child where INST_ID = in_Hid and INST_STATUS

Regarding ORA 21000

懵懂的女人 提交于 2019-12-23 07:38:47
问题 I am struggling with an ORA 21000 which says ORA-21000: error number argument to raise_application_error of 3739 is out of range . This error is coming intermittently. I am not sure why this is occurring. This worked absolutely fine earlier, but after migrating to Linux from Solaris, this error has suddenly come up. Googling it didn't help. Please help. Thanks in Advance. 回答1: RAISE_APPLICATION_ERROR is a method by which an application can raise a custom error in Oracle, which is why there

SQL: Need to remove duplicate rows in query

自古美人都是妖i 提交于 2019-12-23 06:58:26
问题 I need help in getting this result either by using SQL query or procedure. My sample table structure is given below. Required Result : docid status 24 Waiver Requested 26 Waiver Requested 27 Rejected Table A: docid ---------- 24 26 27 Table b: docid Status 24 Waiver Requested 26 Rejected 26 Waiver Requested 27 Rejected 27 Rejected 回答1: Not knowing all of your business rules other than the one you gave, here is a more general solution. Create another table (or perhaps your data model already