Need assistance with conditional join in SQL

Hi All -
I need to ask for help with this query:
Create table user_tab_col_test (table_name varchar2(30), column_name varchar2(30), data_type varchar2(30));
Insert into user_tab_col_test (table_name, column_name, data_type) values ('table1', 'column1', 'varchar2')
Insert into user_tab_col_test (table_name, column_name, data_type) values ('table1', 'column2', 'varchar2')
Insert into user_tab_col_test (table_name, column_name, data_type) values ('table1', 'column3', 'varchar2')
Insert into user_tab_col_test (table_name, column_name, data_type) values ('table1', 'column4', 'varchar2')
Insert into user_tab_col_test (table_name, column_name, data_type) values ('table2', 'column1', 'varchar2')
Insert into user_tab_col_test (table_name, column_name, data_type) values ('table2', 'column2', 'varchar2')
Insert into user_tab_col_test (table_name, column_name, data_type) values ('table2', 'column3', 'varchar2')
Insert into user_tab_col_test (table_name, column_name, data_type) values ('table2', 'column4', 'varchar2')
Commit;
Create table all_cons_columns_test (table_name varchar2(30), column_name varchar2(30), constraint_name varchar2(30))
Insert into all_cons_columns_test (table_name, column_name, constraint_name) values ('table1', 'column1', 'primary')
Insert into all_cons_columns_test (table_name, column_name, constraint_name) values ('table1', 'column1', 'secondary')
Commit;
This is my query and the current result:
Select u.table_name, u.column_name, c.constraint_name
From user_tab_col_test u
Left outer join all_cons_columns_test c
On ( u.table_name = c.table_name
AND U.COLUMN_NAME = C.COLUMN_NAME
AND C.CONSTRAINT_NAME IN ('primary'))
order by U.table_name, U.COLUMN_NAME;
TABLE_NAME COLUMN_NAME CONSTRAINT_NAME
table1 column1 primary
table1 column2
table1 column3
table2 column1
table2 column2
Three questions:
1) I only want to return results where table_name = 'table1'. I can't seem to get this to work.
2) Is my query proper and is this the best way to return my desired results? I.e. I want all columns from user_tab_col_test and I only want to display the constraint_name from all_cons_columns_test if the constraint_name = 'primary'.
3) Will the synatx be the same if I need to join a third table to all_cons_columns_test?
Any advice/suggestions are much appreciated -
john
Edited by: user703358 on Jan 11, 2013 8:57 PM
Edited by: user703358 on Jan 11, 2013 9:48 PM

Hi,
user703358 wrote:
... ALL_CONSTRAINTS_TEST joins to ALL_CONS_COLUMNS_TEST on TABLE_NAME and CONSTRAINT_NAME. If you adapt this to use the data dictionary views ALL_CONSTRAINTS and ALL_CONS_COLUMNS, then rememeber to join on the OWNER column, also.
Ultimately I want to use ALL_CONSTRAINTS_TEST.CONSTRAINT_TYPE = 'P' in my WHERE clause, instead of C.CONSTRAINT_NAME IN (primary), only because the constraint_type is a more definitive attribute than just the name of the constraint.
I tried something like the query below but I'm getting
ORA-00904: "U"."COLUMN_NAME": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:  
*Action:
Error at Line: 8 Column: 16Errors like that are caused by trying to mix old join syntax with ANSI join syntax in the same query.
SELECT    u.table_name
,       u.column_name
,       C.CONSTRAINT_NAME
FROM           USER_TAB_COL_TEST      U,
ALL_CONSTRAINTS_TEST ACAbove is an example of an old-style join: there is a comma between the table names, and the join conditions are included in the WHERE clause below.
LEFT OUTER JOIN  all_cons_columns_test  c
ON    u.table_name    = c.table_name
AND   U.COLUMN_NAME    = C.COLUMN_NAMEThis is an example of an ANSI-style join: the keyword JOIN appears between the table names, and the join conditions are right here, after the keyword ON.
WHERE      U.TABLE_NAME    = 'table1'
AND C.TABLE_NAME = AC.TABLE_NAME
AND C.CONSTRAINT_NAME = AC.CONSTRAINT_NAME
and AC.CONSTRAINT_TYPE = 'P'
ORDER BY  u.table_name
,           u.column_name
;While it is possible to use both join styles in the same query, it's a really bad idea. I suggest always using ANSI syntax, especially for outer joins, but whatever style you choose, use it consistently for all joins in the same query.
In this case, you want an inner join between tablec c and ac, so the ANSI syntax would be something like
FROM  u  LEFT OUTER JOIN c ON ... JOIN ac ON ...In this case, it's very important that the inner join between c and ac is done before the outer join with u. How can you make sure that happens? Well, if you have an arithmetic expression such as
12 * 5 - 1and you want to make sure the subtraction of 1 from 5 takes place before the multiplication by 12, what do you do? You can add parentheses:
12 * ( 5 - 1 )In ANSI join syntax, you can use parentheses the same way:
FROM  u  LEFT OUTER JOIN ( c ON ... JOIN ac ON ... )or, in full:
SELECT    u.table_name
,        u.column_name
,        c.constraint_name
,       ac.constraint_type
FROM             user_tab_col_test      u
LEFT OUTER JOIN  (
                         all_cons_columns_test  c
           JOIN  all_constraints_test   ac
                             ON   ac.table_name     = c.table_name
                      AND  ac.constraint_name     = c.constraint_name
                        ON    u.table_name       = c.table_name
               AND   u.column_name       = c.column_name
               AND   ac.constraint_type  = 'P'
WHERE       u.table_name     = 'table1'
ORDER BY  u.table_name
,            u.column_name
;Output:
TABLE_NAME COLUMN_NAME CONSTRAINT_NAME CONSTRAINT_TYPE
table1     column1     primary         P
table1     column2
table1     column3
table1     column4

Similar Messages

  • Need help with conditional join....

    Table 1 - Student
    ID# Name
    1 # A
    2 # B
    3 # C
    4 # D
    Table2 - Marks
    ID Marks Display
    1 # 10 # Y
    1 # 20 # Y
    1 # 14 # N
    2 # 12 # N
    2 # 13 # N
    3 # 12 # Y
    Result...Need query to do this?..
    Want to join above two tables and display marks as X when there is no ID in table marks or there is ID but all marked with display as 'N'...if there is one or more
    marked with Y then display with marks..
    I am using oracle 11i.
    ID NAme      Marks
    1 # A     #     10
    1 # A     #     20
    2 # B # X
    3 # C # 12
    4 # D # X

    Or, using ANSI join syntax:
    with Table1 as (
                    select 1 id,'A' name from dual union all
                    select 2,'B' from dual union all
                    select 3,'C' from dual union all
                    select 4,'D' from dual
         Table2 as (
                    select 1 id,10 marks,'Y' display from dual union all
                    select 1,20,'Y' from dual union all
                    select 1,14,'N' from dual union all
                    select 2,12,'N' from dual union all
                    select 2,13,'N' from dual union all
                    select 3,12,'Y' from dual
    -- end of on-the-fly data sample
    select  t1.id,
            name,
            nvl(to_char(marks),'X') marks
      from      Table1 t1
            left join
                Table2 t2
              on (
                      t2.id = t1.id
                  and
                      display = 'Y'
      order by id
            ID NAME                                                    MARKS
             1 A                                                       10
             1 A                                                       20
             2 B                                                       X
             3 C                                                       12
             4 D                                                       X
    SQL> SY.

  • Need assistance with Windows 2008 R2 server BSOD - ATTEMPTED_EXECUTE_OF_NOEXECUTE_MEMORY (fc)

    Need assistance with Windows 2008 R2 server BSOD - ATTEMPTED_EXECUTE_OF_NOEXECUTE_MEMORY (fc)
    I have a Windows 2008 R2 server which is experiencing random BSOD during the night. This is occurring maybe once or twice a week. I have gathered two Memory crash files. This server is running Citrix XenApp 6.5 but nothing else is reporting an issue except
    for the memory dump. I’m looking for assistance in reading crash file and finding the cause.
    I’ve spent over a week going through articles trying to learn and trouble shoot the BSOD but no closer to understanding the WinDbg 6.3.9600 report.
    This is a production server and I have verified that Windows Updates has updated the server with latest releases. I’m hoping that the crash file will show something before I have to run the Driver Verifier.
    The crash zip file is located -
    https://onedrive.live.com/redir?resid=9644A4E0A26873B1!2359&authkey=!AMS4Svuk-SS3-JA&ithint=file%2czip
    *                        Bugcheck Analysis                                   
    ATTEMPTED_EXECUTE_OF_NOEXECUTE_MEMORY (fc)
    An attempt was made to execute non-executable memory.  The guilty driver
    is on the stack trace (and is typically the current instruction pointer).
    When possible, the guilty driver's name (Unicode string) is printed on
    the bugcheck screen and saved in KiBugCheckDriver.
    Arguments:
    Arg1: fffff880009eff38, Virtual address for the attempted execute.
    Arg2: 8000000002cfe963, PTE contents.
    Arg3: fffff8800da2eea0, (reserved)
    Arg4: 0000000000000002, (reserved)
    Debugging Details:
    DEFAULT_BUCKET_ID:  WIN7_DRIVER_FAULT
    BUGCHECK_STR:  0xFC
    PROCESS_NAME:  powershell.exe
    CURRENT_IRQL:  0
    ANALYSIS_VERSION: 6.3.9600.17237 (debuggers(dbg).140716-0327) amd64fre
    TRAP_FRAME:  fffff8800da2eea0 -- (.trap 0xfffff8800da2eea0)
    NOTE: The trap frame does not contain all registers.
    Some register values may be zeroed or incorrect.
    rax=fffffa80070f3648 rbx=0000000000000000 rcx=fffffa80070f3648
    rdx=fffff8800da2fbf8 rsi=0000000000000000 rdi=0000000000000000
    rip=fffff80001680b80 rsp=fffff8800da2f030 rbp=fffff8800da2fbd0
     r8=fffff8a01804c680  r9=fffff8800da2fc68 r10=fffffffffffffffd
    r11=fffff8800da2fa90 r12=0000000000000000 r13=0000000000000000
    r14=0000000000000000 r15=0000000000000000
    iopl=0         nv up di pl nz na pe nc
    nt!KiPageFault:
    fffff800`01680b80 55              push    rbp
    Resetting default scope
    STACK_COMMAND:  kb
    FOLLOWUP_IP:
    nt! ?? ::FNODOBFM::`string'+44dfc
    fffff800`017008b8 cc              int     3
    SYMBOL_STACK_INDEX:  1
    SYMBOL_NAME:  nt! ?? ::FNODOBFM::`string'+44dfc
    FOLLOWUP_NAME:  MachineOwner
    MODULE_NAME: nt
    IMAGE_NAME:  ntkrnlmp.exe
    DEBUG_FLR_IMAGE_TIMESTAMP:  531590fb
    IMAGE_VERSION:  6.1.7601.18409
    FAILURE_BUCKET_ID:  X64_0xFC_nt!_??_::FNODOBFM::_string_+44dfc
    BUCKET_ID:  X64_0xFC_nt!_??_::FNODOBFM::_string_+44dfc
    ANALYSIS_SOURCE:  KM
    FAILURE_ID_HASH_STRING:  km:x64_0xfc_nt!_??_::fnodobfm::_string_+44dfc
    FAILURE_ID_HASH:  {aa632d36-b0f7-67cf-89e2-1cec389c0a11}
    Followup: MachineOwner

    Hi Kaysel_GTG,
    Just addition. Regarding to Bug Check 0xFC, please refer to following article and check if can help you.
    Bug Check 0xFC: ATTEMPTED_EXECUTE_OF_NOEXECUTE_MEMORY
    By the way, since it is not effective for us to debug the crash dump file here in the forum. If this issues is a state of emergency for you. Please contact Microsoft Customer
    Service and Support (CSS) via telephone so that a dedicated Support Professional can assist with your request.
    To obtain the phone numbers for specific technology request, please refer to the web site listed below:
    http://support.microsoft.com/default.aspx?scid=fh;EN-US;OfferProPhone#faq607
    if any update, please feel free to let us know.
    Hope this helps.
    Best regards,
    Justin Gu

  • HT201209 I need assistance with trying to figure out how to change my security code answer

    I need assistance with trying to figure out how to change my security code answer

    If you mean the answers to your security questions, then f
    rom http://support.apple.com/kb/HT5665 :
    If you have three security questions and a rescue email address
    sign in to My Apple ID and select the Password and Security tab to send an email to your rescue email address to reset your security questions and answers (the steps half-way down that page should give you a reset link)
    If you have one security question and you know your Apple ID passwordsign in to My Apple ID and select the Password and Security tab to reset your security question.
    If you have one security question, but don't remember your Apple ID passwordcontact Apple Support for assistance. Learn more about creating a temporary support PIN to help Apple confirm your identity when you contact Apple Support.
    If you can’t reset them via the above instructions (you won't be able to add a rescue email address until you can answer your questions) then you will need to contact iTunes Support / Apple in your country to get the questions reset.
    Contacting Apple about account security : http://support.apple.com/kb/HT5699
    When they've been reset (and if you don't already have a rescue email address) you can then use the steps half-way down this page to add a rescue email address for potential future use : http://support.apple.com/kb/HT5312

  • Need assistance with my Porsche Design LaCie Time Capsule... It is not operating at all.. I have ran the diagnostic via the Disk Utility and under the error reading it runs the repair and then says it not about to repair what do I do... Thanks

    Need assistance with my Porsche Design LaCie Time Capsule... It is not operating at all.. I have ran the diagnostic via the Disk Utility and under the error reading it runs the repair and then says it not about to repair what do I do... Thanks

    LaCie doesnt make ANYTHING.  It contains a Seagate 3.5" 5400RPM HD.
    Check the HD on another computer, if nothing, your SATA bridge is fried, or the HD (very unlikely since its a Seagate inside)
    Youd have to crack open the HD, remove the SATA bridge cart thats plugged into the HD and put the HD into an enclosure or a HD dock to get the data
    those external HD use a 50 cent SATA bridge famous for failing.  The curse of all the good HD externals is the junk 3rd party SATA bridges attached to them that crash and burn.
    Sata bridge:

  • I need assistance with uploading pictures from mobile connection to computer

    I need assistance with uploading pictures from my mobile to my computer

    I need assistance with uploading pictures from my mobile to my computer

  • I need assistance with changing language from German to English

    I need assistance with changing language from German to English. Unable to uninstall product from control panel.

    What exactly means "unable"?
    Since you mention Control Panel, I assume that you are on Windows.  Try using http://labs.adobe.com/downloads/acrobatcleaner.html

  • Need help with conditional query

    guys this is just an extension of this post that Frank was helping me with. im reposting because my requirements have changes slightly and im having a hell of a time trying to modify the query.
    here is the previous post.
    need help with query that can look data back please help.
    CREATE TABLE "FGL"
        "FGL_GRNT_CODE" VARCHAR2(60),
        "FGL_FUND_CODE" VARCHAR2(60),
        "FGL_ACCT_CODE" VARCHAR2(60),
        "FGL_ORGN_CODE" VARCHAR2(60),
        "FGL_PROG_CODE" VARCHAR2(60),
        "FGL_GRNT_YEAR" VARCHAR2(60),
        "FGL_PERIOD"    VARCHAR2(60),
        "FGL_BUDGET"    VARCHAR2(60)
      )data
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','00','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7200','4730','02','10','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7600','4730','02','10','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','2','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','11','2','600');
    I need to find the greatest grant year for the grant by a period parameter.
    once i find the greatest year i need to check the value of period 14 for that grant for the previous year and add it to the budget amount for that grant. however if their is an entry in the greatest year for period 00 then i need to ignore the period 14 of previous year and do this calculation current period +(current period - greatest year 00)
    hope that makes sense so in other words with the new data above. if i was querying period two of grant year 11. i would end up with $800
    because the greatest year is 11 it contains a period 0 with amount of $400 so my total should be
    period 2 amount $ 600
    period 0 amount $ 400 - period 2 amount of $600 = 200
    600+200 = $800
    if i query period 1 of grant 360055 i would just end up with 800 of grnt year 10.
    i have tried to modify that query you supplied to me with no luck. I have tried for several day but im embarrased to say i just can get it to do what im trying to do .
    can you please help me out.
    here is the query supplied by frank kulash who gracefully put this together for me.
    WITH     got_greatest_year     AS
         SELECT     fgl.*     -- or whatever columns are needed
         ,     MAX ( CASE
                     WHEN  fgl_period = :given_period
                     THEN  fgl_grnt_year
                    END
                  ) OVER ()     AS greatest_year
         FROM     fgl
    SELECT     SUM (fgl_budget)     AS total_budget     -- or SELECT *
    FROM     got_greatest_year
    WHERE     (     fgl_grnt_year     = greatest_year
         AND     fgl_period     = :given_period
    OR     (     fgl_grnt_year     = greatest_year - 1
         AND     fgl_period     = 14
    ;Miguel

    Hi, Miguel,
    Are you waying that, when the greatest year that has :given_period also has period='00' (or '0', or whatever you want to use), then you want to double the budget from the given_period (as well as subtract the budget from the '00', and not count the pevious year's '14')? If so, add another condition to the CASE statement which decides what you're SUMming:
    WITH     got_greatest_year     AS
         SELECT       TO_NUMBER (fgl_grnt_year)     AS grnt_year
         ,       fgl_period
         ,       TO_NUMBER (fgl_budget)     AS budget
         ,       MAX ( CASE
                       WHEN  fgl_period = :given_period
                       THEN  TO_NUMBER (fgl_grnt_year)
                      END
                    ) OVER ()     AS greatest_year
         FROM       fgl
    ,     got_cnt_00     AS
         SELECT     grnt_year
         ,     fgl_period
         ,     budget
         ,     greatest_year
         ,     COUNT ( CASE
                       WHEN  grnt_year     = greatest_year
                       AND       fgl_period     = '00'
                       THEN  1
                         END
                    ) OVER ()          AS cnt_00
         FROM    got_greatest_year
    SELECT       SUM ( CASE
                        WHEN  grnt_year     = greatest_year                    -- New
                  AND       fgl_period     = :given_period                    -- New
                  AND       cnt_00     > 0            THEN  budget * 2     -- New
                        WHEN  grnt_year     = greatest_year
                  AND       fgl_period     = :given_period       THEN  budget
                        WHEN  grnt_year     = greatest_year
                  AND       fgl_period     = '00'            THEN -budget
                        WHEN  grnt_year     = greatest_year - 1
                  AND       fgl_period     = '14'     
                  AND       cnt_00     = 0            THEN  budget
                    END
               )          AS total_budget
    FROM       got_cnt_00
    ;You'll notice this is the same as the previous query I posted, except for 3 lines maked "New".

  • Need help with self join query

    Hello,
    I have table A with the following data
    oid parent_oid
    10 4
    4 2
    2 2
    12 6
    6 6
    parent_oid is the parent of oid. I'd like a query that shows the final parent of the oid. The result should show the following
    oid final parent
    10 2
    4 2
    2 2
    12 6
    6 6
    I'm using Oracle 10g. I'm familiar with self joins, but that alone will not do the job. Thanks!

    Hi,
    arizona9952 wrote:
    ... I'm familiar with self joins, but that alone will not do the job.You're absolutely right!
    A 2-way self join would work for rows have no parent, or rows that are directly connected to their final ancestor (such as oid=4), but not for anything farther away.
    A 3-way self-join would work for one more level away from the final row, but no more. That would be enough for the small set of sample data that you posted, but it would not work if you added a new row with parent_id=10.
    An N-way self-join would work for up to N+1 levels, but no more.
    You need something that can go any number of levels, such as CONNECT BY:
    SELECT     CONNECT_BY_ROOT oid     AS oid
    ,     parent_oid          AS final_parent
    FROM     a
    WHERE     CONNECT_BY_ISLEAF     = 1
    CONNECT BY     oid     = PRIOR parent_oid
         AND     oid     != parent_oid
    ;Edited by: Frank Kulash on Feb 22, 2010 7:09 PM
    Upon sober reflection, I think that a Top-Down query, like the one below, would be more efficient than a Bottom-Up query, like the one above:
    SELECT     oid
    ,     CONNECT_BY_ROOT     parent_oid     AS final_parent
    FROM     a
    START WITH     parent_oid     = oid
    CONNECT BY     parent_oid     = PRIOR oid
         AND     oid          != PRIOR oid
    ;

  • Need assistance with multiple issues with several G5's

    Hello All,
    I need to get some assistance with some issues that I am having with several G5 Dual’s
    I just started a new position and I have 4-G5 Dual’s that are in various states of disrepair. Normally I would call Apple support but they did not purchase the extended AppleCare packages for any of the G5’s theu purchased and they are ALL over a year old now. Any suggestions would be greatly appreciated.
    G5 number 1 - Has its fans running at full output all the time. Could this be a firmware issue?
    G5 number 2 – Had it’s logic board replaced by one of our company computer techs and now at start up gives a long tone then boots to white screen with a command prompt. Requiring me to either type “mac-boot” or “shutdown”. If I continue the boot process the machine just goes to a gray screen and stalls. I researched this yesterday and tried several solutions I found here but to no avail. Seems to me that past of the issue is that it is stuck looking for a firmware upgrade. How do I get past it?
    G5 number 3 – Mac seems to boot correctly but when you click on the Apple icon in the upper left hand corner the Finder blinks out and then comes back. It does this every time we try to go to the Apple menu. We removed the original hard drive and installed in a known good drive, our tech drive with a G5 image, rebooted the mac and the same issue occurs with the Finder.
    G5 number 4 – This unit boots to black screen with a Unix command prompt displaying “root#”. Any thoughts.
    Thanks
    Paul
    G5 Dual   Mac OS X (10.3.9)  
    G5 Dual   Mac OS X (10.3.9)  

    Apparantly someone not certified to repair them messed them up.
    Tell bossman it would be in his best interest for you to take them to a authorized Apple Repair and get it done with.
    Tell him that Mac's rarley screw up hardware wise and there really hasn't been a great demand for skilled repair techs outside of Apple.
    If your worried about your job, tell him you can take care of the software, training, minor hardware and networking end of the matter. Which, luckily for you, are longtern and ongoing needs. You can tell him that.
    There's nothing wrong in admitting you don't know how to do something and keeping your job, than to be unable to fix them and lose your job.

  • Need Assistance With Custom Calculation Script

    I need help with a custom calculation script in Acrobat Pro.  I am trying to add the sum of fields A, B, C, D, E, F, and G together with the lesser value of fields H and I.  What would be the script to enter for this result?  Thank you.

    event.value = Number(this.getField("A").value) + Number(this.getField("B").value) + Number(this.getField("C").value) + Number(this.getField("D").value) + Number(this.getField("E").value) + Number(this.getField("F").value) + Number(this.getField("G").value) + Math.min(Number(this.getField("H").value), Number(this.getField("I").value));

  • Need Assistance with Plugin

    I am trying to acess my Nascar trackpass. I keep getting an error message that my flashplayer plug in keeps crashing. What Can I do?

    Hi Kaysel_GTG,
    Just addition. Regarding to Bug Check 0xFC, please refer to following article and check if can help you.
    Bug Check 0xFC: ATTEMPTED_EXECUTE_OF_NOEXECUTE_MEMORY
    By the way, since it is not effective for us to debug the crash dump file here in the forum. If this issues is a state of emergency for you. Please contact Microsoft Customer
    Service and Support (CSS) via telephone so that a dedicated Support Professional can assist with your request.
    To obtain the phone numbers for specific technology request, please refer to the web site listed below:
    http://support.microsoft.com/default.aspx?scid=fh;EN-US;OfferProPhone#faq607
    if any update, please feel free to let us know.
    Hope this helps.
    Best regards,
    Justin Gu

  • Need assistance with query

    Sorry, I'm having a brain freeze on this.
    Oracle 10.2.0.4
    Sample data:
    SQL> conn scott/tiger
    Connected.
    SQL> drop table employees;
    Table dropped.
    SQL> create table employees (
      2    ssn varchar2(9),
      3    svc_cde varchar2(3));
    Table created.
    SQL> --
    SQL> drop table accounts;
    Table dropped.
    SQL> create table accounts (
      2    ssn varchar2(9),
      3    empname varchar2(9),
      4    accountno varchar2(5));
    Table created.
    SQL> -- insert 3 emp recs for a current employee
    SQL> insert into employees values ('123450001','123');
    1 row created.
    SQL> insert into employees values ('123450001','234');
    1 row created.
    SQL> insert into employees values ('123450001','999');
    1 row created.
    SQL> --
    SQL> -- insert 2 emp recs for a past employee
    SQL> insert into employees values ('123450002','345');
    1 row created.
    SQL> insert into employees values ('123450002','456');
    1 row created.
    SQL> --
    SQL> -- insert 1 account rec for each employee
    SQL> insert into accounts values ('12345001','fred','98765');
    1 row created.
    SQL> insert into accounts values ('12345002','joe','87654');
    1 row created.
    SQL> --
    SQL> /*
    SQL> select * from employees;
    SQL> select * from accounts;
    SQL> select distinct ssn
    SQL> from employees
    SQL> where svc_cde <> '999'
    SQL> ;
    SQL> */
    SQL> select  a.empname,
      2          a.ssn,
      3          a.accountno
      4  from accounts a,
      5       employees p
      6  where a.ssn = p.ssn
      7    and a.ssn not in (select distinct ssn
      8                      from employees
      9                      where svc_cde = '999')
    10  ;
    no rows selected
    SQL>What I need is a list of all rows from ACCOUNTS for which the ssn does not have a row with svc_cde = '999', and avoiding the cartesian join stemming from the fact that a given SSN may have multiple employee records with svc_cde <> '999'. So from the above, I need the query to return one row for Joe, ssn='12345002'

    Hi,
    EdStevens wrote:
    Frank -
    It seems I mis-spoke. We do have people in the acct table that do not appear in the employee table, and they should NOT appear in the final result. I put together a test for that condition with the code you provided and in my test it worked correctly, but against live data I am again picking up current employees - as identified by have an employee rec with a svc_cde of '999999999'.
    Here is my complete test script (raw script this time!)Yes, that's much better.
    set echo on feedback on verify on trimsp on tab off
    conn scott/tigerI suggest you don't use the Oracle-supplied schemas, like scott, for your own objects. It can cause problems when migrating to a new database. Create a test schema just for jobs like this. (This has nothing to do with your present problem, of course.)
    drop table employees; ...
    -- insert 3 emp recs for a current  employee
    insert into employees values ('123450001','123456789');
    insert into employees values ('123450001','234567890');
    insert into employees values ('123450001','999999999');
    -- insert 2 emp recs for a past employee
    insert into employees values ('123450002','345678901');
    insert into employees values ('123450002','456789012');
    -- insert 1 account rec for current employee
    insert into cardacct values ('123450001','current','98765');
    -- insert 1 account rec for former employee
    insert into cardacct values ('123450002','former','87654');
    -- insert 1 account rec for non employee
    insert into cardacct values ('123450003','nonemp','76543');The comments are very helpful. It's good to have concise terms like "current" and "former", and I'm not sure I would have understood them without these comments.
    ... Exactly what I need. But somehow if I run this against live data I also get a hit on the 'current' employee, while the 'non-employees' are correctly filtered out. Can you think of a condition that could throw this, that I simply haven't accounted for in my test setup?Post some sample data that shows the error. I know this may be hard to do, but, unfortunately, if I can't re-create the problem, there's not much I can do to solve it. This is sort of like the rattle in yur car that never occurs when you take it to the mechanic.
    Are you saying that there are some current employees (similar to '123450001', who have at least one svc_cde='999999999') who are appearing in the result set? Post an example. Does that employee have so many rows in employees that it's hard to post the sample data? Find out exactly which rows are causing the problem, and post only those rows. That is, say there are 20 rows in employees for that person. Find one of the rows with svc_cde='999999999', and make sure it is always in the sample data. (That row alone should be sufficient to keep the person out of the result set.) Now comment out half of the remaining rows, say 9 rows. Does the problem still exist with the remaining 11 rows (the 10 you didn't comment out, plus the 1 with '999999999' that you'll never comment out)? If so, comment out half of the reamining rows. Does the problem still exist with the remaining 6 rows? If not, add back half of the rows you commented out in the last step. Eventually you should be able to find one row that is causing the problem. Chances are, the cause of the problem, and maybe the solution, will be obvious at that point, but if not, post it here, and say exactly which row you found to cause the problem.
    Does the prolem occur with all current employees, or just certain ones? If it's only certain ones, can you see any pattern in which employees have the problem, and which ones don't?
    Are you sure these are the only relevant columns? That is, you simplified the data for posting; did you also simplify the query? Are there some other conditions or joins that occur in your real query, but you didn't psot here, because you didn't think they had anything to do with the problem? Maybe they do, after all.
    I really need to see the problem before I can fix it.

  • Need help with query joining several tables into a single return line

    what i have:
    tableA:
    puid, task
    id0, task0
    id1, task1
    id2, task2
    tableB:
    puid, seq, state
    id0, 0, foo
    id0, 1, bar
    id0, 2, me
    id1, 0, foo
    id2, 0, foo
    id2, 1, bar
    tableC:
    puid, seq, date
    id0, 0, 12/21
    id0, 1, 12/22
    id0, 2, 12/22
    id1, 0, 12/23
    id2, 0, 12/22
    id2, 1, 12/23
    what i'd like to return:
    id0, task0, 12/21, 12/22, 12/22
    id1, task1, 12/23, N/A, N/A
    id2, task2, 12/22, 12/23, N/A
    N/A doesn't mean return the string "N/A"... it just means there was no value, so we don't need anything in this column (null?)
    i can get output like below through several joins, however i was hoping to condense each "id" into a single line...
    id0, task0, 12/21
    id0, task0, 12/22
    id0, task0, 12/23
    id1, task1, 12/23
    is this possible fairly easily?
    Edited by: user9979830 on Mar 29, 2011 10:53 AM
    Edited by: user9979830 on Mar 29, 2011 10:58 AM

    Hi,
    Welcome to the forum!
    user9979830 wrote:
    what i have:...Thanks for posting that so clearly!
    Whenever you have a question, it's even better if you post CREATE TABLE and INSERT statements for your sample data, like this:
    CREATE TABLE     tablea
    (       puid     VARCHAR2 (5)
    ,     task     VARCHAR2 (5)
    INSERT INTO tablea (puid, task) VALUES ('id0',  'task0');
    INSERT INTO tablea (puid, task) VALUES ('id1',  'task1');
    INSERT INTO tablea (puid, task) VALUES ('id2',  'task2');
    CREATE TABLE     tablec
    (       puid     VARCHAR2 (5)
    ,     seq     NUMBER (3)
    ,     dt     DATE          -- DATE is not a good column name
    INSERT INTO tablec (puid, seq, dt) VALUES ('id0',  0,  DATE '2010-12-21');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id0',  1,  DATE '2010-12-22');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id0',  2,  DATE '2010-12-22');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id1',  0,  DATE '2010-12-23');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id2',  0,  DATE '2010-12-22');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id2',  1,  DATE '2010-12-23');This way, people can re-create the problem and test their ideas.
    It doesn't look like tableb plays any role in this problem, so I didn't post it.
    Explain how you get the results from that data. For example, why do you want this row in the results:
    PUID  TASK  DT1        DT2        DT3
    id0   task0 12/21/2010 12/22/2010 12/22/2010rather than, say
    PUID  TASK  DT1        DT2        DT3
    id0   task0 12/22/2010 12/21/2010 12/22/2010? Does 12/21 have to go in the first column because it is the earliest date, or is it because 12/21 is related to the lowest seq value? Or do you even care about the order, just as long as all 3 dates are shown?
    Always say what version of Oracle you're uisng. The query below will work in Oracle 9 (and up), but starting in Oracle 11, the SELECT ... PIVOT feature could help you.
    i can get output like below through several joins, however i was hoping to condense each "id" into a single line... Condensing the output, so that there's only one line for each puid, sounds like a job for "GROUP BY puid":
    WITH     got_r_num     AS
         SELECT     puid
         ,     dt
         ,     ROW_NUMBER () OVER ( PARTITION BY  puid
                                   ORDER BY          seq          -- and/or dt
                           )         AS r_num
         FROM    tablec
    --     WHERE     ...     -- If you need any filtering, put it here
    SELECT       a.puid
    ,       a.task
    ,       MIN (CASE WHEN r.r_num = 1 THEN r.dt END)     AS dt1
    ,       MIN (CASE WHEN r.r_num = 2 THEN r.dt END)     AS dt2
    ,       MIN (CASE WHEN r.r_num = 3 THEN r.dt END)     AS dt3
    ,       MIN (CASE WHEN r.r_num = 4 THEN r.dt END)     AS dt4
    FROM       tablea    a
    JOIN       got_r_num r  ON   a.puid  = r.puid
    GROUP BY  a.puid
    ,            a.task
    ORDER BY  a.puid
    ;I'm guessing that you want the dates arranged by seq; that is, for each puid, the date related to the lowest seq comes first, regardless of whther that date is the earliest date for that puid or not. If that's not what you need, then change the analytic ORDER BY clause.
    This does not assume that the seq values are always consecutive integers (0, 1, 2, ...) for each puid. You can skip, or even duplicate values. However, if the values are always consecutive integers, starting from 0, then you could simplify this. You won't need a sub-query at all; just use seq instead of r_num in the main query.
    Here's the output I got from the query above:
    PUID  TASK  DT1        DT2        DT3        DT4
    id0   task0 12/21/2010 12/22/2010 12/22/2010
    id1   task1 12/23/2010
    id2   task2 12/22/2010 12/23/2010As posted, the query will display the first 4 dts for each puid.
    If there are fewer than 4 dts for a puid, the query will still work. It will leave some columns NULL at the end.
    If there are more than 4 dts for a puid, the query will still work. It will display the first 4, and ignore the others.
    There's nothing special about the number 4; you could make it 3, or 5, or 35, but whatever number you choose, you have to hard-code that many columns into the query, and always get that many columns of output.
    For various ways to deal with a variable number of pivoted coolumns, see the following thread:
    PL/SQL
    This question actually doesn't have anything to do with SQL*Plus; it's strictly a SQL question, and SQL questions are best posted on the "SQL and PL/SQL" forum:
    PL/SQL
    If you're not sure whether a question is more of a SQL question or a SQL*Plus question, then post it on the SQL forum. Many more people pay attention to that forum than to this one.

  • Need help with conditional display

    I found a older thread (704012) that explains how to conditionally display a link using style.  Which is what I want to do.  The part I'm having trouble with is that part of the instructions say to put
    class="row_has_values_#HAS_VALUES#"
    in the Link Attributes which I have done.  I also have a column in the report called HAS_VALUES and I'm properly populating it in my select.  I know because I left it displayed while I'm testing.  I can run the report and I have Y's and N's showing up in that column but the conditional part does not work.  When I look at the page source (below) I see that in the html the #HAS_VALUES# has not been replaced by the actual Y or N.  I think that's where I'm having trouble?  I think it might work if there was a Y or N in that but I don't understand why that didn't happen.
    <tr class="odd"><td headers="LINK"><a href="f?p=125:3:12628966088981::NO::P3_PROGRAM_KEY:2" class="row_has_values_#HAS_VALUES#"><img src="/i/e2.gif"  border="0"></a></td><td  align="left"

    LawrenceJ wrote:
    I've continued to snoop around and see lots of posts on conditional display in reports.  Common desire I guess.  I saw some stuff that I interpreted to suggest that what I'm trying to do may not work in interactive reports, only in classic reports.  Does that sound familiar?
    That would certainly apply to anything template-related. However there have been enhancements to IRs (like adding HTML Expressions) that might supersede information in older posts. If you provide a link to the sources you've found and the APEX version you're using someone will be able to confirm whether that information is relevant.
    Many other posts on doing things conditionally in reports seemed to lean towards "selecting" the html based on data values and then just letting that get put in the report column.  That looks promising but sure is a bit ugly.  I've very little apex experience but lots of mod pl/sql and that sort of solution was pretty common when I did stuff with it.  I saw a little suggesting using templates as a solution but I'll confess to not understanding it at all.
    As I pointed out in the original thread, if the conditional display of the link is in any way security related then CSS or JS/jQuery methods are not acceptable. If the user is not supposed to be able to click the link or see any data contained in it, then you have to use a method that ensures that the link element never reaches the browser.
    Hard-coding the link HTML in the report query is the common approach, but is as you say a bit ugly. Using a custom report template (my favourite APEX subject) enables clean separation of the report query, conditional logic and HTML structure. If you know HTML then you're advised to get familiar with using templates in APEX. You'll find this a major advance on the PL/SQL web toolkit. What is it that you're not understanding about using templates?

Maybe you are looking for