Craig Collins

Greenhorn
+ Follow
since Mar 30, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Craig Collins

Hi there, perhaps you could describe the data in the tables, i.e. what entities the tables represent, and the attributes in each table.

we have an Employee table presumably with Name, Date of Birth ...
but what are the other tables?
15 years ago
Assuming you are storing data in a relational database then the concept of normalisation must come in to play here ...

if storing all person data in one table will mean there will be redundant data then this should be avoided.

classic example is Employees and Departments;

an Employee may work in only one Department
but a Department may employ many Employees

so we make one table for Employees and one table for Departments - otherwise for employees working in the same department we will end up storing the department name many times (redundant data).



more difficult to maintain data integrity in this case - when the dept name changes need to find all occurences of the dept name - dept name may end up coded slightly differently for different emps (IT, I.T, it, ...).

Depends on your data - if data in the tables is related in a one-to-one relationship then could store in one table.

Hope this helps.
15 years ago
Here is my attempt today, with improvements after reading a few threads here!

In reverse() I'm throwing an IllegalArgumentException ... propogating it to
main() ... catch it there and print the stack trace;



Running this with 1) a string 2) no argument and 3) an empty String "" produces;



cheers and good luck!
[ April 01, 2008: Message edited by: Craig Collins ]
From the oracle docs,

Oracle uses blank characters to fill format elements to a constant width equal to the largest element for the relevant format model in the current session language.



I'm guessing to accomodate the (possible) minus sign oracle pads the 4 digit format model to 5 characters!

So a solution using TO_CHAR is to use a Format Model Modifier to control this blank padding.




Could also use LPAD - LPAD definition in Oracle SQL Language Reference



lpad(string, length of string returned, character to use to pad).

lpad return a string of either varchar2, nvarchar2, or LOB depending on the datatype of your string.
15 years ago
Sorry, i compiled with javac -verbose option and discovered that although

told me version 6
actually the path was searching on an older version
>java -version
java version "1.6.0_05"



many thanks
I also find the leading space after converting the sequence to a character!?

I thought that if the empID in the table is a NUMBER datatype it may be better to explicitly cast the generated key value into a NUMBER. Any error generated when trying to convert to number could be handled in an exception and then calculate and return a valid number - also perhaps it is uneccessary to declare the local variables and we could then make only one call to the SQL engine;


[ March 31, 2008: Message edited by: Craig Collins ]
15 years ago
On my WinXP JDK 1.5 the following compiles;

public class InstanceOfTest {

public static void main (String [] args) {

Short s = new Short("15");
Boolean b;

if (b = (s instanceof Short)) {
System.out.print("s instance of Short - ok");}
}
}

but on 1.6 only by replacing the wrapped Boolean object to a primitive will the source compile. The compiler says it expects a boolean in the If statement rejecting / not unboxing the object!

Can anyone please explain?
Thanks