RE: Date-based query Q
Thanks for everyone's help with this one, btw. In the end I bit the bullet and added a dates table. -- Aidan Whitehall <mailto:[EMAIL PROTECTED]> Macromedia ColdFusion Developer Fairbanks Environmental Ltd +44 (0)1695 51775 Queen's Awards Winner 2003 <http://www.fairbanks.co.uk/go/awards> This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Aidan Whitehall INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Date-based query Q
This is probably a no-brainer... We have some date-based data for which most days have several records but where some days have none. I'm COUNT()ing the number of records for each day (between day x and day y) and need a record set that also includes a row for those days which have no records: UkDate Total 1/1/20035 2/1/20036 3/1/20030 4/1/20036 I could post-process the record set to achieve this, but is there any way in 9i to do an aggregate query with an outer join on a date range (if that makes sense)? Someone made the suggestion of creating another table with a row for every day under the sun in it, against which you could inner join the main query, but I'm not keen on that (that is just a gut response though). Any ideas? Thanks! -- Aidan Whitehall <mailto:[EMAIL PROTECTED]> Macromedia ColdFusion Developer Fairbanks Environmental Ltd +44 (0)1695 51775 Queen's Awards Winner 2003 <http://www.fairbanks.co.uk/go/awards> This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Aidan Whitehall INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Dump table to file, edit and reimport
In Sybase's ASA there was an "unload" command which wrote to a text file the SQL to recreate a table, along with all it's data which running the SQL then imported. This allowed you to very easily dump a table, edit it's structure and suck the data back in. The closest thing I've found in Oracle is right-clicking on a table | Data Management | Export. However, we're not running the Oracle Management Server (just because we don't know how to set that up yet), so this functionality isn't available. Barring installing OMS, is there a quick and dirty way to do this? And, if the answer is "no", is OMS easy to set up? Thanks! -- Aidan Whitehall <[EMAIL PROTECTED]> Macromedia ColdFusion Developer Fairbanks Environmental Ltd +44 (0)1695 51775 This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Aidan Whitehall INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: Restricting the range of values in a field
> please remember us when the list of "2-to-5 values that never change" > change. and we tell you "we told you so". > > and why do you care if the developer will get mad? he's wrong. you know, I > know it and everyone on this list knows it. > > foreign keys are the final answer. > > that is all. In the main, I absolutely agree (i.e. I don't think lookup tables are inherently "bad"). However, in this particular instance, the check constraint is a perfect solution (I won't bore you with the reasons why). -- Aidan Whitehall <[EMAIL PROTECTED]> Macromedia ColdFusion Developer Fairbanks Environmental Ltd +44 (0)1695 51775 This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ____ -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Aidan Whitehall INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: Restricting the range of values in a field
>Yes. Read up on check constraints. Thanks for everyone's suggestions and code. I'll go with the check constraint in this instance because 10-or-so lookup tables with 2-to-5 values in each that will never change seems like overkill. Plus, the other developer here isn't a fan of lookup tables where the range of values are known to be static and he'd shout at me ;-) Thanks again! -- Aidan Whitehall <[EMAIL PROTECTED]> Macromedia ColdFusion Developer Fairbanks Environmental Ltd +44 (0)1695 51775 This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Aidan Whitehall INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Restricting the range of values in a field
Is there any way you can specify that the only permissible values (is it called a domain?) that can be entered in varchar2 field in an Oracle table to, for example, A, B and C? We can restrict what values users can enter at the application level, but it would be nice to be able to also restrict what can be entered at the database level, in case other means of entering data are ever used or if the application layer fails, for whatever reason, to trap an unwanted value. Thanks -- Aidan Whitehall <[EMAIL PROTECTED]> Macromedia ColdFusion Developer Fairbanks Environmental Ltd +44 (0)1695 51775 This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Aidan Whitehall INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: Right ()
> order by to_number(substr(lt_tk_id,length(lt_tk_id)-1)) Brilliant. Thanks to everyone that mentioned substr. -- Aidan Whitehall <[EMAIL PROTECTED]> Macromedia ColdFusion Developer Fairbanks Environmental Ltd +44 (0)1695 51775 This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Aidan Whitehall INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Right()
Please don't laugh. What is the equivalent of a Right() function in Oracle? I want to be able to sort a column numerically whose string contents takes the format "v1, v2, v3, v4". I was after something like: ORDER BY Cast(Right(lt_tk_id, Length(lt_tk_id - 1)) as int) but it's not playing nice. Order by Right(lt_tk_id, 1) gives the same error, so I assume that's where it's falling down. I've searched everywhere I can think of for "right function", Oracle online docs, Enterprise Manager docs, Google, but nothing seems to come close. BTW, is it my imagination or do the docs leave a lot to be desired? Thanks -- Aidan Whitehall <[EMAIL PROTECTED]> Macromedia ColdFusion Developer Fairbanks Environmental Ltd +44 (0)1695 51775 This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Aidan Whitehall INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).