Unix Technical Forum

sql dummies

This is a discussion on sql dummies within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Hello, I'm switching from sybase to oracle. With sybase, I was used to start with sql-dummies like select 'test' ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 09:04 AM
Marten Lehmann
 
Posts: n/a
Default sql dummies

Hello,

I'm switching from sybase to oracle. With sybase, I was used to start
with sql-dummies like

select 'test'

so I could build the whole application on top of the sql-statement and
later I replaced this dummy by a real sql-statement querying table data.

How can I do this with oracle? Oracle doesn't allow a statement like the
above one.

Regards
Marten
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 09:04 AM
Randy Harris
 
Posts: n/a
Default Re: sql dummies

Marten Lehmann wrote:
> Hello,
>
> I'm switching from sybase to oracle. With sybase, I was used to start
> with sql-dummies like
>
> select 'test'
>
> so I could build the whole application on top of the sql-statement and
> later I replaced this dummy by a real sql-statement querying table data.
>
> How can I do this with oracle? Oracle doesn't allow a statement like the
> above one.
>
> Regards
> Marten


Perhaps, if you indicate what it is you want to do, rather than what
command you used in Sybase, someone might be able to help.

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 09:04 AM
Marten Lehmann
 
Posts: n/a
Default Re: sql dummies

> Perhaps, if you indicate what it is you want to do, rather than what
> command you used in Sybase, someone might be able to help.


Sorry, I thought thats clear. Just assume that my final sql-statement
will return exactly one row of data with lets say 3 rows. So could be
something like

select fname, lname, city from employees where id = 123

But at the start of my project, this table doesn't exist and the whole
table design isn't ready yet. But I know that the query will return one
row with the expected fields. So at the start I could use a dummy like this

select 'Bill', 'Gates', 'Redmond'

which would return

'Bill', 'Gates', 'Redmond'

in one row as it could happen with the first statement. The first
statement could be far more complex, so using dummies is definetely a
good idea for the start. How can I do this in Oracle? I'm sure there is
a way.

Regards
Marten
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 09:04 AM
Marten Lehmann
 
Posts: n/a
Default Re: sql dummies

> will return exactly one row of data with lets say 3 rows.

Sorry, I was meaning columns.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-08-2008, 09:04 AM
Terry Dykstra
 
Posts: n/a
Default Re: sql dummies



"Marten Lehmann" <lehmannmapson@cnm.de> wrote in message
news:48j1ggFkh97kU2@individual.net...
> > will return exactly one row of data with lets say 3 rows.

>
> Sorry, I was meaning columns.



select 'a','b','c' from dual;

--
Terry Dykstra
Canadian Forest Oil Ltd.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-08-2008, 09:04 AM
GJW
 
Posts: n/a
Default Re: sql dummies

Marten Lehmann wrote:
>> will return exactly one row of data with lets say 3 rows.

>
> Sorry, I was meaning columns.


I believe you want to do the following:

SELECT 'Bill', 'Gates', 'Redmond' FROM dual;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-08-2008, 09:04 AM
HansF
 
Posts: n/a
Default Re: sql dummies

On Fri, 24 Mar 2006 21:03:25 +0100, Marten Lehmann wrote:

>> will return exactly one row of data with lets say 3 rows.

>
> Sorry, I was meaning columns.


You apparently are looking for a placeholder mechanism.

In Oracle, I believe the closest thing you will find is the 'DUAL' table,
which has one real column and one real row.

Select * from dual;

will always return one row, one column. You can then use literal to be
placeholders for the further expressions you need in development. (The
simplest expression being, of course, a simple column or literal.)

One caution - there are enough differences between Oracle and Sybase
internals that you will have some challenges in your approach. I
strongly encourage reading Tom Kyte's books (see http://www.apress.com)
before proceeding - the list of challenges IS long enough and complex
enough to fill a book.

--
Hans Forbrich
Canada-wide Oracle training and consulting
mailto: Fuzzy.GreyBeard_at_gmail.com
*** Top posting [replies] guarantees I won't respond. ***

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:02 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com