All Questions
7,582
questions
278votes
9answers
768kviews
How do I do top 1 in Oracle? [duplicate]
How do I do the following?
select top 1 Fname from MyTbl
In Oracle 11g?
128votes
7answers
508kviews
Display names of all constraints for a table in Oracle SQL
I have defined a name for each of the constraint for the multiple tables that I have created in Oracle SQL.
The problem is that to drop a constraint for the column of a particular table I need to ...
92votes
5answers
260kviews
How to create a new schema/new user in Oracle Database 11g?
I have applied for an internship in a company and as a question they have asked me to create a schema for their company with certain requirements and mail them the DDL file. I have installed Oracle ...
83votes
6answers
571kviews
Left Outer Join using + sign in Oracle 11g
Can any one tell me whether below 2 queries are an example of Left Outer Join or Right Outer Join??
Table Part:
Name Null? Type
PART_ID NOT NULL VARCHAR2(4)
SUPPLIER_ID ...
76votes
6answers
429kviews
How to find the users list in oracle 11g db?
How to find out the users list, which is all created in the oracle 11g database. Is there any command to find out the users list which we can execute from the Command line interface!
62votes
3answers
73kviews
Using the DISTINCT keyword causes this error: not a SELECTed expression
I have a query that looks something like this:
SELECT DISTINCT share.rooms
FROM Shares share
left join share.rooms.buildingAdditions.buildings.buildingInfoses as bi
... //where clause omitted
ORDER ...
61votes
7answers
174kviews
How can I select from list of values in Oracle
I am referring to this stackoverflow answer:
How can I select from list of values in SQL Server
How could something similar be done in Oracle?
I've seen the other answers on this page that use UNION ...
58votes
6answers
328kviews
Add days Oracle SQL
SELECT ORDER_NUM, CUSTOMER_NUM, CUSTOMER_NAME, ADD_DAYS (ORDER_DATE, 20)
FROM CUSTOMER, ORDERS;
Oracle Express says ADD_DAYS invalid? Any ideas what Am I doing wrong?
53votes
4answers
187kviews
SQL to add column and comment in table in single command
I am using Oracle 11g for my web application. I want to add a column and a comment to an existing table. I can do that easily with the below commands
ALTER TABLE product ADD product_description ...
52votes
3answers
462kviews
Calling a stored procedure in Oracle with IN and OUT parameters
I have this procedure:
CREATE OR REPLACE PROCEDURE PROC1(invoicenr IN NUMBER, amnt OUT NUMBER)
AS BEGIN
SELECT AMOUNT INTO amnt FROM INVOICE WHERE INVOICE_NR = invoicenr;
END;
So when I run it like ...
46votes
5answers
236kviews
INSERT SELECT statement in Oracle 11G
I'm trying to run a very simple sql statement in Oracle 11g.
insert into table1 (col1, col2) values (select t1.col1, t2.col2 from oldtable1 t1, oldtable2 t2);
Very simple query. Cartesian join old ...
45votes
5answers
247kviews
Using bind variables with dynamic SELECT INTO clause in PL/SQL
I have a question regarding where bind variables can be used in a dynamic SQL statement in PL/SQL.
For example, I know that this is valid:
CREATE OR REPLACE FUNCTION get_num_of_employees (p_loc ...
44votes
6answers
298kviews
How can I get the number of days between 2 dates in Oracle 11g? [duplicate]
I'm trying to find an integer number of days between two dates in Oracle 11g.
I can get close by doing
select sysdate - to_date('2009-10-01', 'yyyy-mm-dd') from dual
but this returns an interval,...
44votes
8answers
78kviews
BETWEEN clause versus <= AND >=
Is there a performance difference between using a BETWEEN clause or using <= AND >= comparisons?
i.e. these two queries:
SELECT *
FROM table
WHERE year BETWEEN '2005' AND '2010';
...and
...
41votes
11answers
163kviews
How to increase buffer size in Oracle SQL Developer to view all records?
How to increase buffer size in Oracle SQL Developer to view all records (there seems to be a certain limit set at default)? Any screen shots and/or tips will be very helpful.