File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes scalar functions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "scalar functions" Watch "scalar functions" New topic

scalar functions

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

Has anyone used scalar functions in JDBC? Examples will be helpful.

Joshua Doerring

Joined: Aug 08, 2003
Posts: 19
I use scalar functions to get date information from date fields in a query.
For example I have a table called EMPLOYEE and it has a BIRTHDATE field. If I wanted to split out the month, day, year here's how I'd do that.
SELECT firstname, lastname, MONTH(birthdate), DAY(birthdate), YEAR(birthdate)
FROM employee
WHERE department = "01"
You'd get something like this:
Bob, Smith, 8, 25, 1971
Sam, Thompson, 5, 11, 1966
I agree. Here's the link:
subject: scalar functions
It's not a secret anymore!