I enjoyed the answers and questions about hidden features in sql server
What can you tell us about Oracle?
Hidden tables, inner workings of ..., secret stored procs, package that has good utils...
We are using a JEE application and we are right now using Informix DB.Our code hits the DB with queries like
"select first 10 * from test"
Now as far as I know Oracle does not support 'first 10 *' kind of statements.We have more than 1000 queries like this.Should we manually change this or can have some manual customization?
The following is my table design:
Ecode Degree YOQ
7654321 SSC 2000
7654321 HSC 2002
7654321 Bcom 2006
7654321 MCA 2010
7654322 SSC 2002
7654322 HSC 2004
7654322 Bcom 2007
7654323 SSC 2002
7654323 HSC 2004
7654323 BE 2008
I want the following formatted output using an oracle query:
Ecode Degree year
7654321 SSC,HSC,Bcom,MCA 2000,2002,2006,2010
7654322 SSC,HSC,Bcom 2002,2004,2007
7654323 SSC,HSC,BE 2002,2004,2008
How can this be done?
Hi all,
I am creating test cases and I need to cover circular dependencies. So far I have been able to create two tables such that Table A has a FK to B and B has a FK to A.
What other circular dependencies exist / are allowed between objects? I tried to create cycles between Views but Oracle successfully rejected that.
I am trying to enforce a CHECK Constraint in a ORACLE Database on multiple tables
CREATE TABLE RollingStocks (
Id NUMBER,
Name Varchar2(80) NOT NULL,
RollingStockCategoryId NUMBER NOT NULL,
CONSTRAINT Pk_RollingStocks Primary Key (Id),
CONSTRAINT Check_RollingStocks_CategoryId
CHECK ((RollingStockCategoryId IN (SELECT Id FROM FreightWagonTypes))
OR
(RollingStockCategoryId IN (SELECT Id FROM LocomotiveClasses)))
);
...but i get the following error:
*Cause: Subquery is not allowed here in the statement.
*Action: Remove the subquery from the statement.
Can you help me understanding what is the problem or how to achieve the same result?
I have the following query that runs in my Oracle database and I want to have the equivalent for a SQL Server 2008 database:
SELECT TRUNC( /* Midnight Sunday */
NEXT_DAY(SYSDATE, 'SUN') - (7*LEVEL)
) AS week_start,
TRUNC( /* 23:59:59 Saturday */
NEXT_DAY(NEXT_DAY(SYSDATE, 'SUN') - (7*LEVEL), 'SAT') + 1
) - (1/(60*24)) + (59/(60*60*24)) AS week_end
FROM DUAL
CONNECT BY LEVEL <= 4 /* Get the past 4 weeks */
What the query does is get the start of the week and the end of the week for the last 4 weeks. It generates data like the following:
WEEK_START WEEK_END
2010-03-07 00:00:00 2010-03-13 23:59:59
2010-02-28 00:00:00 2010-03-06 23:59:59
...
I have implemented below sample. It is working fine. I am planning to integrate with this .net application. As soon i read the entry i would like to dequeue the entry. Can any one tell how i can achive that.
http://www.oracle-base.com/articles/10g/dbms_change_notification_10gR2.php
Meanwhile i am trying AQ. But it does not have good .net (C#)support
Having a sequence, I need to find out which table.column gets its values. As far as I know, Oracle doesn't keep track of this relationship. So, looking up for the sequence in source code would be the only way. Is that right?
Anyone knows of some way to find out this sequence-table relationship?
Hi,
I need to transform the rows into columns for the similar ID's in oracle
e.g.
The following is the result I will get if i query my database
Col1 Col2 Col3
1 ABC Yes
1 XYZ NO
2 ABC NO
I need to transform this into
Col1 Col2 Col3 Col4 Col5
1 ABC Yes XYZ No
2 ABC NO NULL NULL
Someone please help me in solving this issue
Thanks,
Siv
Hi. I am having problem with importing csv files containing values in japanese characters. When I do so it will display garbage when I query. my OS is japanese. My encoding for oracle NLS_LANG is JAPANESE_JAPAN.JA16SJISTILDE. I don't know what the problem is. When I try to import the very same file in some of my office mates' PC it just works fine
When Oracle is estimating the 'Cost' for certain queries, does it actually look at the amount of data (rows) in a table?
For example:
If I'm doing a full table scan of employees for name='Bob', does it estimate the cost by counting the amount of existing rows, or is it always a set cost?
Can I send this query from my C# connection to my oracle connection?
"Select Object_name,status from object_name where object_type='function';"
or
"Select Object_name,status from object_name where object_type='Procedure';"
or
because as I remember, I have this problem when I write a program to connect to Access with java,those days I try to submit some query to get all table name.
regard.
Hello,
I am trying to build an oracle stored procedure which will accept a table name as a parameter.
The procedure will then rebuild all indexes on the table.
My problem is I get an error while using the ALTER command from a stored procedure, as if PLSQL does not allow that command.
how to insert rows in a excel sheet into Sql server 2005 or oracle ?
for example if i have 5000 rows in excel sheet how can i insert these rows into a table in any database
how to call a oracle database storedprocedure from asp.net mvc using nhibernate and how to use sys_refcursor to display a data in view pages give me sample application . thanks
How to insert rows in an Excel sheet into SQL Server 2005 or oracle ?
For example if I have 5000 rows in Excel sheet how can I insert these rows into a table in any database
I am writing a sql query which involves finding if timestamp falls in particular range of days.
I have written that in the postgres but it doesn't works in Oracle and SQL Server:
AND creation_date < (CURRENT_TIMESTAMP - interval '5 days')
AND creation_date >= (CURRENT_TIMESTAMP - interval '15 days')
Is there are common way to compare the timestamp across different databases?
Hi,
We have a weird instance where we noticed our oracle database server swap utilization was 100% and surprised to see that the system had free memory available during that period. To my knowledge, swap memory utilization starts once system runs out of free RAM (please correct me if i'm wrong). Not sure what could have caused this unusual activity. Had anyone else experienced such behaviour?
Regs,
if not (i_ReLaunch = 1 and (dt_enddate is not null))
How this epression will be evaluated in Oracle 10g
when the input value of the i_ReLaunch = null and the value of the dt_enddate is not null
it is entering the loop.
According to the rules in normal c# and all it should not enter the loop as
it will be as follows with the values.
If( not(false and (true))
= if not( false)
=if( true) which implies it should enters the loop
But it is not happening
Can someone let me know if i am wrong at any place
Please help me make an oracle stored procedure ; I have two tables
tblLead:
lead_id Name
1 x
2 y
3 z
tblTransaction:
Tran_id lead_id date status
1 1 04/20/2010 call Later
2 1 05/05/2010 confirmed
I want a result like
lead_id Name status
1 x confirmed
2 y not available !
3 z not available !
I set my NLS_LANG variable as 'AMERICAN_AMERICA.AL32UTF8' in the perl file that connects to oracle and tries to insert the data.
However when I insert a record with one value having this 'ñ' character the sql fails.
But if I use 'Ñ' it inserts just fine.
What am I doing wrong here?
Dears,
I have a report server project in VS2005, and I added an oracle data source to my project and I did anything like my college! both of us did the same settings but I can't connect to the server. I connected to DB in TOAD but in VS2005 I couldn't. What should I check?
I get this error during test connection :
ORA-12154: TNS:could not resolve the connect identifier specified
I see people writing a function with FUNCTION instead "CREATE FUNCTION". When I saw this usage in the web I thought it was a typo or something. But in Oreilly's "Oracle 11g PL/SQL Programming" by Steven Feurenstein, the author had used the same thing. But I get errors when I execute that. Could somebody explain is it legal usage or not?. Thanks.
I'm trying to connect to an oracle database with .net but i get the error:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
however, when I enter add a new database connection through toolsconnect to database. it works fine. even after copying the connection string which is:
Data Source=source here;Persist Security Info=True;User ID=userhere;Password=pass;Unicode=True