Re: Need Urgent Help with SQL Syntax & Oracle

From: Steve Long <slong3_at_mediaone.net>
Date: Tue, 04 Sep 2001 12:17:27 GMT
Message-ID: <rD3l7.4639$1s1.55342_at_typhoon.jacksonville.mediaone.net>


if i get the gist of what you are saying, you have received a flat file with four or more fields which are loaded into some table(s) and are having primary key problems, or at least unique id problems. lacking any more understanding of your environment, i offer the following suggestion.

  1. modify the table(s) to have a primary key column. generate the primary key using a sequence number(s).
  2. load the table(s) using SQL*Loader or your favorite load utility (i suspect something is already in place for this).
  3. if you need foreign keys between tables, use the primary keys generated by the sequence number(s).

create triggers to manipulate sequence numbers as primary and foreign keys if you want to avoid modification of the existing load routines.

hth

steve

"Thorsten" <tjaenichen_at_hotmail.com> wrote in message news:79ab94fa.0109040243.5a681b81_at_posting.google.com...
> Hi,
>
> *******LONG EXPLANATION, SKIP IT IF U LIKE AND JUMP RIGHT INTO THE
> QUESTION AT THE BOTTOM
>
> I have a realy big problem. We get a whole bunch of Data from an
> external Provider coming along as somthing like
> name/value/unit/descr... The guy that developed the system (wich i
> have to maintain :( ) put a 2nd. table where comments to each set of
> values is stored.
> what i have to do now is pull some of these out in kind of flat way.
>
> for some reason these tables dont have a unique id but have a uid and
> timestamp so i take one set of UID's and timestamp's and take the
> comments from one table plus the values/descr.... from the other and
> put them together in a view.
> This works so far. I get one record with the uid, timestamp and one
> row for each value and descr.
>
> now the problem is that for some reason i have for the same uid 1
> record in the values table and 2 records in the comments table... but
> the timestamps are also the same. seems that the software that is
> filling the tables if buggy and inserts the old timestamp into a new
> record if its for the same user.
>
> BUT, there is also another Date given for each record that is in a
> DD/MM/YYYY HH:MM:SS format. I have no Idea what its for, but these
> dates seem to be the actual time.
>
> QUESTION:
> Now my Question is, is there a way to do something like:
>
> SELECT * FROM table1, table2 WHERE
> table1.date isPlusMinusOneHourOf table2.date
Received on Tue Sep 04 2001 - 14:17:27 CEST

Original text of this message