Results 1 to 6 of 6

Thread: SQL Help

  1. #1
    Join Date
    Feb 2003
    Location
    South Africa
    Posts
    41

    Unhappy Unanswered: SQL Help

    I got a Table that holds Translations for my program. The problem is maintaining this table or keeping it up to date (+-3000 records).

    The Columns are
    MSG_ID
    TITLE
    LANG
    and there is a unique constraint on MSG_ID and LANG.

    What I doing now is basically selecting distinct all the LANG and then selecting the entire table where LANG = ENGLISH

    Then I got a loop (in VB) that checks if each English MSG_ID is in the other LANGs and then I Insert it if it doesnt find anything.

    Please help me find a faster way as this takes forever.

  2. #2
    Join Date
    Aug 2003
    Posts
    123
    I could not understand your question, please tell what exactly you want to do with the existing table, do you want to create a new table with only msg in english ??


    --Jaggu

  3. #3
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: SQL Help

    This select will show you what is missing:

    SELECT t.msg_id, l.lang
    FROM Translations t, Languages l
    MINUS
    SELECT t.msg_id, t.lang
    FROM Tranlations t;

    If you don't have a table of Languages, you could replace that in the FROM clause like this:

    FROM Translations t, (SELECT DISTINCT lang FROM Translations) l

    You could turn that into an INSERT statement, but where will it get the translated text from?

  4. #4
    Join Date
    Feb 2003
    Location
    South Africa
    Posts
    41
    Sorry about...

    I only one table, UT_MESSAGES

    The problem is that I can only maintain the English Translations in the table.

    Eg.
    MSG_ID , TITLE , LANG
    ------------------------------
    1 , Title, ENG
    2 , Desc, ENG
    1 , Titel, POR

    Now, I need a select statement that will tell me that 1 POR translation is missing.

    Andrewst, I tried that select statement but it returns no rows

  5. #5
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    This is what I meant:

    SQL> select t.msg_id, l.lang
    2 from ut_messages t, (select distinct lang from ut_messages) l
    3 MINUS
    4 select t.msg_id, t.lang
    5* from ut_messages t;

    MSG_ID LAN
    ---------- ---
    2 POR

  6. #6
    Join Date
    Feb 2003
    Location
    South Africa
    Posts
    41

    Thumbs up

    Sorry, it would have worked the first time. I am such a idiot, I forgot to hit Commit in TOAD when I insert the POR Translation.

    I modified the SQL abit to

    SELECT t.message_id, l.lang_id, t.description from ut_messages t, (select distinct lang_id from ut_messages) l
    MINUS (select t.message_id, t.lang_id,t.description from ut_messages t);

    and now it returns the TEXT for the translation as well (defaulted to English or which ever other langauge has it)

    Thank you so much for the help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •