SunQuest
           Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old April 23rd, 2008, 06:40 AM
akumos akumos is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 5 akumos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 29 sec
Reputation Power: 0
Help with SQL

Hi, can someone please help me with the following.

Say this was my code:

CREATE TABLE person
(
name VARCHAR2(30),
dob DATE
);

First question. How do I make everything entered into the name field UPPERCASE?

secondly, how would I insert a date using the following code:

INSERT INTO person VALUES
('mike', '1987-03-17');

This format results in an error!

thanks for all your help.
Adam

Reply With Quote
  #2  
Old April 23rd, 2008, 06:59 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,711 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 6 Days 4 h 53 m 59 sec
Reputation Power: 259
First answer: with a trigger, if your mysql version supports them, but I'd not bother about this and simply convert everything to uppercase when retrieving
Second one: check the manual for the proper date format

Reply With Quote
  #3  
Old April 23rd, 2008, 07:20 AM
r937's Avatar
r937 r937 is offline
SQL Consultant
Dev Shed God 25th Plane (17000 - 17499 posts)
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 17,343 r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 5 Days 8 h 5 m 22 sec
Reputation Power: 891
Quote:
Originally Posted by akumos
secondly, how would I insert a date using the following code:

INSERT INTO person VALUES
('mike', '1987-03-17');
you would do it exactly like that

are you sure you are running mysql?

mysql doesn't support VARCHAR2, so i don't think you would have been able to create that table
Comments on this post
pabloj agrees: Right, Oracle maybe?
__________________
r937.com | rudy.ca

Reply With Quote
  #4  
Old April 23rd, 2008, 07:49 AM
shammat shammat is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Munich, Bavaria
Posts: 971 shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 44 m 15 sec
Reputation Power: 57
INSERT INTO person VALUES
('mike', '1987-03-17');
Quote:
Originally Posted by r937
you would do it exactly like that
Depending on the current setting of NLS_DATE that is (if it is indeed Oracle)

Reply With Quote
  #5  
Old April 23rd, 2008, 07:49 AM
akumos akumos is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 5 akumos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 29 sec
Reputation Power: 0
I am using varchar2 so maybe not mysql? what version of SQL would it be?

Also, how do i create a composit key?

This results in errors:

CREATE TABLE person
(
name VARCHAR2(30),
phone char(11)

PRIMARY KEY (name, phone)
);

thanks again.

Reply With Quote
  #6  
Old April 23rd, 2008, 07:52 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,711 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 6 Days 4 h 53 m 59 sec
Reputation Power: 259
First of all confirm if you are on mysql or another database

Reply With Quote
  #7  
Old April 23rd, 2008, 10:26 AM
akumos akumos is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 5 akumos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 29 sec
Reputation Power: 0
It must not be, it's called iSQL *plus

Which forum do I post in? Is it MS SQL?

thanks

Reply With Quote
  #8  
Old April 23rd, 2008, 10:29 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,711 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 6 Days 4 h 53 m 59 sec
Reputation Power: 259
Google would tell you that iSQL*plus is for Oracle (read more here , ask a mod to move this thread there.
Then read about oracle's to_date()

Reply With Quote
  #9  
Old April 26th, 2008, 02:49 AM
vpire vpire is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 150 vpire User rank is Corporal (100 - 500 Reputation Level)vpire User rank is Corporal (100 - 500 Reputation Level)vpire User rank is Corporal (100 - 500 Reputation Level)vpire User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 6 h 56 m 44 sec
Reputation Power: 6
isql is come with oracle and it is being use in the oracle enterprise manager web environment. Most of the time dba will just turn that service off to save some resources since most dba are comfortable using just sqlplus.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Help with SQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway