Conditional Column Value

I am attempting to display individuals (lastname, firstname) and corporations in the same column. I have an if statement in my select to display either Adams, Mike or Adams Car Wash. I am getting the following error: ORA-00907: missing right parenthesis
Here's my sql:
SELECT SPRIDEN.SPRIDEN_ID, SPRIDEN.SPRIDEN_CHANGE_IND, SPRIDEN.SPRIDEN_ENTITY_IND,
SPRIDEN.SPRIDEN_LAST_NAME || ', ' || SPRIDEN.SPRIDEN_FIRST_NAME AS Name,
IIf (SPRIDEN.SPRIDEN_ENTITY_IND='P',Name, SPRIDEN.SPRIDEN_LAST_NAME) VenName,
FROM SPRIDEN
I have tried adding/deleting ")" without any success. Your comments / suggestions would be appreciated.
Chuck

My Access knowledge is pretty much non-existant, but assuming IIF is defined to return the second argument if the first argument is true and the third argument otherwise, you would want
DECODE( SPRIDEN.SPRIDEN_ENTITY_IND,
        'P',Name,
        SPRIDEN.SPRIDEN_LAST_NAME )in Oracle. If you are on 9i, you could also use the more generic CASE syntax
CASE WHEN SPRIDEN.SPRIDEN_ENTITY_IND = 'P'
     THEN Name
     ELSE SPRIDEN.SPRIDEN_LAST_NAME
     ENDJustin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC

Similar Messages

  • How to refer a column value of a single row in conditional column display?

    Hello,
    does anybody have an idea, how i can refer a column value of a single row in conditional display of a column?
    So my idea is, that a report has a column, which value is only displayed, when another column value of this row has a specific value.
    I want to solve this problem with condition type: PL/SQL Function Body returning a boolean.
    But I do not know how to refer the column value of each single row!
    Thank you,
    Tim

    Here's a solution that, to me, seems easier to implement but, that's, of course, in the eye of the implementer.
    Rather than using APEX to generate a link column for you, actually create the link as part of your SQL.
    select '<a href="f?p=102:3:491847682940364::::P3_CONTACT_ID:' || CONTACT_ID || "><img src="/i/themes/theme_1/ed-item.gif" alt="Edit"></a>' CONTACT_LINK, ...
    etc.
    Test this out. You'll see that it works just like making a column a link using the column attributes.
    Next, we'll change the SQL to use a DECODE statement to either display the link or nothing depending on what your criteria is. For example, let's assume you only want a link for active contacts.
    select Decode( CONTACT_STATUS, 'A', '<a href="f?p=102:3:491847682940364::::P3_CONTACT_ID:' || CONTACT_ID || "><img src="/i/themes/theme_1/ed-item.gif" alt="Edit"></a>', NULL ) CONTACT_LINK, ...
    etc.
    This will not display the link in any rows in which the CONTACT_STATUS is not active, i.e. "A"
    -Joe

  • Reports - Passing checkbox values and conditional column visibility

    Although I've been using Oracle databases for many years, I've to admit I'm rather new to APEX. I'm building a first prototype project to convince our project leaders and managers of the usefulness of the product for future projects (as for visual Database interfaces where the accent is on forms and reporting, it will often be faster and less expensive to build an APEX application instead of a full blown Java or C# webapp).
    I'm however encountering some problems.
    Let me start with a quick description. I've the following parent/child structures:
    Provinces > Cities > Intersections > Loops > Loop Detections.
    I basically want to make a report on the loop detections. Now, considering we'll have many thousands of detections a day, I made kind of a drilldown structure. You first choose your province, then the city, then the intersection and finally the loop. I didn't use lists to make the selection. Instead I made a (classic) report for each part as this allows me to give detailed information for each part. In each report, I made a link on the identifier. For example, when I select a province (by clicking on the link), I pass the province identifier to the cities report and use it in the query to limit my report to those cities for the given province. I repeat these step for the different parts, which in the end, gives me the loop detections for the selected loop. The good news is all this works fine. The person who'll be using this application however made a suggestion and asked if it would not be possible to select different loops and as such get the detections for several loops (the rest of the application stays the same). This however means I cannot use the column link anymore. Now, I was thinking in the direction of a checkbox. The column link is still there, but the user would also have the possibility to select several items in the report. I managad to add a checkbox to the report, linked to the loop identifier column. That's not exactly difficult. I cannot figure out however, how I can pass the selected identifiers to the next report (detections for the selected loops) and use it in the underlaying query of this report. The problem is, I don't know how to pass the checked values to the next page and how to use these values in the report query of that page. I suppose this must be possible, but I couldn't figure out how. I tried playing around with APEX_APPLICATION.G_Fxx and such. Remember I'm a newbie and this seems to fall under more advanced features.
    I've uploaded images of the 2 concerning report pages for illustration:
    http://img96.imageshack.us/img96/1497/apex01.jpg
    http://img140.imageshack.us/img140/9868/apex02.jpg
    A second point that's bothering me is the following. In the loop detection report I show a colum link (I picked an icon instead of the column value) for each row. I also have a column that shows the number of detections for the given loop (and day). Now, for some loops, there are no detections for that given day. As such, there's no point in selecting this loop, as the result will be an empty report. However, I still want to show the loop in the loop selection report, as it's still present (it's not as if it suddenly disappeared). Sure, no big problem and most users probably have sufficient intelligence to figure this out. However, it would be nice if I could make the icon (colum link) visible only for those loops that have detections, or in other words, for those records where number_of_detections (underlaying column COUNT) is greater than 0. I couldn't figure out a way to do this either. The Conditional Display option for a column didn't really offer me a solution here.
    Before I forget, I'm using APEX 4.0.1 on an Oracle XE database.
    Any tips or suggestions would be welcome! :)
    Thanks.
    Erwin

    Hi,
    You mean something like in this sample
    https://apex.oracle.com/pls/otn/f?p=40323:55
    You can store checked values to collection and use it then in another report where clause
    See e.g. this post for how you can store checked rows to collection
    Re: Need help with APEX_Collection
    In sample DEPT report query is
    SELECT
      CASE WHEN EXISTS(SELECT 1 FROM emp e WHERE e.deptno = d.deptno) THEN
        APEX_ITEM.CHECKBOX(1,c.c002,'onclick="saveDeptChk(this,'||c.seq_id||')"','true')
      END AS row_selector,
      c.c002 AS checked,
      d.DEPTNO,
      d.DNAME,
      d.LOC
    FROM dept d,
      apex_collections c
    WHERE c.collection_name = 'DEPT_CHK_COLLECTION'
      AND d.deptno = c.c001And EMP report
    SELECT e.EMPNO,
      e.ENAME,
      e.JOB,
      e.MGR,
      e.HIREDATE,
      e.SAL,
      e.COMM,
      e.DEPTNO
    FROM emp e,
      apex_collections c
    WHERE c.collection_name = 'DEPT_CHK_COLLECTION'
      AND c.c002 = 'true'
      AND e.deptno = c.c001Regards,
    Jari

  • Conditional suppress only if all column values are zero

    I would like to suppress whole column if dbfield value is 0.00. I was able to suppress it in common tab of format field by using formula if dbfield =0.00 then true else false.
    But i would like to suppress column value only when all the values in column are equal to 0.00. Otherwise I would like to retain those 0.00.
    Let me know how I can do this?
    Your response is appreciated
    -Thanks
    Raghu

    Go to "Format Field...", select the Common tab, and put something like the following in the Suppress formula.
    Maximum({dbField}) = 0

  • Referencing Aggregated Column Value in Where Clause

    Hello -
    I'm trying to determine how I can accomplish the following in the most straightforward, efficient way.
    Among other things, I'm selecting the following value from my table:
    max(received_date) as last_received_dateI also need to evaluate the "last_received_date" value as a condition in my where clause. However, I can't reference my aliased "last_received_date" column value, and when I try to evaluate max(received_date) in the where clause, I get the "group function is not allowed here" error.
    Does anyone know of a good workaround?
    Thanks,
    Christine

    Hi,
    Column aliases can be used in the ORDER BY clause: aside from that, they cannot be used in the same query where they are defined. The workarounds are
    (a) define the alias in a sub-query, and use it in a super-query, like Someoneelse did, or
    (b) repeat the aliased expression, as in the HAVING-clause, below.
    Aggregate functions are computed after the WHERE-clause. (That explains why you can do things like
    SELECT  MAX (received_date) last_received_date_2008
    FROM    table_x
    WHERE   TO_CHAR (received_date, 'YYYY')  = '2008';).
    The HAVING-clause is like the WHERE-clause, but it is applied after the aggregate functions are computed, e.g.
    SELECT    deptno
    ,         MAX (recieved_date)  AS last_received_date
    FROM      table_x
    GROUP BY  deptno
    HAVING    MAX (received_date)    > SYSDATE - 7   -- Only show deptartments with activity in the last week
    ;

  • Custom row-fetch and how to get column values from specific row of report

    Hi -- I have a case where a table's primary key has more than 3 columns. My report on the
    table has links that send the user to a single-row DML form, but of course the automatic
    fetch won't work because 1) I can't set more than 3 item values in the link and 2) the
    auto fetch only handles 2 PK columns.
    1)
    I have written a custom fetch (not sure it's the most elegant, see second question) that is working
    for 3 or few PK columns (it references the 1-3 item values set in the link), but when there are
    more than 3, I don't know how to get the remaining PK column values for the specific row that was
    selected in the report. How can I access that row's report column values? I'll be doing it from the
    form page, not the report page. (I think... unless you have another suggestion.)
    2)
    My custom fetch... I just worked something out on my own, having no idea how this is typically
    done. For each dependent item (database column) in the form, I have a source of PL/SQL
    function that queries the table for the column in question, using the primary key values. It works
    beautifully, though is just a touch slow on my prototype table, which has 21 columns. Is there
    a way to manually construct the fetch statement once for the whole form, and have APEX be smart
    about what items get what
    return values, so that I don't have to write PL/SQL for every item? Because my query data sources
    are sometimes in remote databases, I have to write manual fetch and dml anyway. Just would like
    to streamline the process.
    Thanks,
    Carol

    HI Andy -- Well, I'd love it if this worked, but I'm unsure how to implement it.
    It seems I can't put this process in the results page (the page w/ the link, that has multiple report rows), because the link for the row will completely bypass any after-submit processes, won't it? I've tried this in other conditions; I thought the link went directly to the linked-to page.
    And, from the test of your suggestion that I've tried, it's not working in the form that allows a single row edit. I tried putting this manually-created fetch into a before header process, and it seems to do nothing (even with a hard-coded PK value, just to test it out). In addition, I'm not sure how, from this page, the process could identify the correct PK values from the report page, unless it can know something about the row that was selected by clicking on the link. It could work if all the PK columns in my edit form could be set by the report link, but sometimes I have up to 5 pk columns.
    Maybe part of the problem is something to do with the source type I have for each of the form items. With my first manual fetch process, they were all pl/sql functions. Not sure what would be appropriate if I can somehow do this with a single (page level?) process.
    Maybe I'm making this too hard?
    Thanks,
    Carol

  • How to change the column value which is coming from DO by a calculated field?

    Hi all,
    I want to change a column value based on my calculated field value. I have a column which is coming from DO which is based on External Data Source. I have a calculated field in my report. When there is any change in the calculated field then the column which is coming from DO needs to be changed. It means the DO needs to get updated when there is a change in the calculated field. Or like if the calculated field meets some condition then I need to change/update the same in the DO. This has to be done on the fly. the report should not submitted for this. when there is a change in the calculated column the DO column needs to get updated.
    Thanks,
    Venky.

    Ok, I've been a customer for very many years, I'm on a fixed retirement
    income.  I need to reduce my bills, my contract ends in  Dec. I will be
    pursuing other options unless I can get some concessions from Verizon.  My
    future son-in-law was given this loyalty plan, so I know this is a
    reasonable request.  My phone number is (removed)  acct number
    (removed)
    >> Personal information removed to comply with the Verizon Wireless Terms of Service <<
    Edited by:  Verizon Moderator

  • How to copy a column value in to a variable in Dataflow task?

    Hi All,
    I want to copy a column value to a variable inside the data flow task. Which is the best way to achieve it in SSIS?
    Thanks,
    Sri

    Unless its a conditional based query which returns a single value it doesnt make sense to store result in a variable.
    If query resultset has multiple values then you cant store them in a variable unless its of type object. The easiest way to store values in that case to object variable is by using execute sql task and then setting resultset option as full resultset. Once
    stored you can use for each loop with ado enumerator or script task to iterate through values of resultset.
    Perhaps you could give us some idea on what you're trying to achieve
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to restrict a table with its set of data based on a column value in it?

    Hi,
    I have a scenario in which I have to show a set of data of a pivot table by restricting data based on a column value. I am creating BIP report whose source is from BIA ie.RPD. Based on a column value I want to restrict the data being displayed in the table. Since I also want the hidden data in the first table to be displayed in another table in the same report I cannot restrict the data at the query level i.e at RPD or at BIA. For this reason I used
    <?xdofx:if saw3_ = 1?>
    the pivot table
    <?end if?>
    But it does not restrict any data.
    Also I tried using the if condition inside the table before the row level looping happens. But no good show even then.
    How can I forgo this problem?
    Regards,
    The MM

    Hi,
    See : http://download.oracle.com/docs/cd/E12096_01/books/PubUser/T421739T481157.htm#4535373 regarding column and row.
    Regards,
    Colectionaru

  • Filter a tableview based on a column value-Navigation Issues.

    Hi,
    I have a table view with total 99 values. The values are displayed in 10 tabs of the table view with 9 values in each tab.I go to the third tab and select a column value, which triggers an event and filters the result list from 99 to 12.
    I am simply removing the collection and filling it again with fresh values.
    My problem is-when i set the collection with new values, i want the end user to be navigated to the first tab.
    But the user is always navigated to the second tab which has the last three values.
    Is there any way to navigate the user to first tab of table view?
    I have already tried-visibleFirstRow and it is not working.
    Thanks and Regards,
    Rohit

    Hi Ashish,
    You can implement some code in DO_INIT_CONTEXT to filter your Items' BOL collection based on the condition quantity <> 0. I believe the Quantity field is available in the BOL structure.
    Here is a code snippet.
    DATA: lr_col TYPE REF TO if_bol_bo_col,
    DATA: lr_node TYPE REF TO if_bol_bo_property_access.
    lr_node = me->typed_context->CONTEXT NODE->collection_wrapper->get_first( ).
    WHILE lr_node IS BOUND.
    CALL METHOD lr_node->get_properties
    IMPORTING
    es_attributes = ls_struct.
    IF ls_struct-quantity = 0 .
      lr_col->remove( iv_bo = lr_node ).
    ENDIF.
      lr_node = lr_col->get_next( ).
    ENDWHILE.
    Regards,
    Masood Imrani S.

  • Aex: dynamic url - need to pass corresponding column values to external url

    Hi All,
    I have created a report in which am trying to click on a column link which is a external url. In the url, part of column value needs to be passed as ID.
    Example: Report
    Name ID     Dept     Details
    King     FIN3413900     Finance     Link
    James     ACC3445812     Accounts     Link
    So when I click on Link it should take me to the page : (See below example)
    Display image for BLOB  Download link in Interactive Report (For King)
    Conditional regions (For James)
    MessageID is no from the column ID. (FIN3413900). Hence it needs to be passed corresponding to the row clicked.
    Common link is http://forums.oracle.com/forums/click.jspa?searchID=-1&messageID= (Only the number is derived directly from column ID).
    I hope the requirement is clear. If any clarifications required let me know.
    Please help me out with the possible solutions....Thanks in Advance....
    Regards,
    Vinoth

    Hi,
    Go to the Report Attributes of your report. The column you have defined for the column link click on the edit icon. In the Column Link section choose target URL and in the URL field enter :-
    http://forums.oracle.com/forums/click.jspa?searchID=-1&messageID=#ID# Where ID is the name of the column that holds the FIN3413900.
    Hope that makes sense :o)
    Regards
    Paul

  • Combine 2 Column Values in One Prompt - - - - Urgent

    Hi Experts,
    I'm Using Obiee10g.
    I have a requirement where i need to create a prompt (based on 2 column values)
    Example: Name of Prompt (Search Agency) it has following values
    Agency Type1
    Agency Type2
    Agency Subtype1
    Agency Subtype2
    Agency Type1, Agency Type2 are Major Types - Which comes from Column: Agency Type
    Agency Subtype1, Agency Subtype2 are subtypes - Which comes from Column: Agency Subtype
    I took a dummy column from subject area. Converted the Prompt to Sql Results and wrote the following condition.
    Select Agency_type from Agency where Agency Type in (Agency Type1, Agency Type2)
    union
    Select Agency_subtype from Agency Where Agency subtype in (Agency Subtype1, Agency Subtype2)
    Now, My Prompt is showing correct values.
    And, My Report has following columns: Agency Id, Agency Name, Agency Type, Agency Subtype (Agency Type is prompted or Agency Subtype is prompted)
    Now, My Prompt and Report not reflects properly as i need to use multi select for prompts
    If, i'm using drop down and storing the values in presentation variable and saying that
    Agency Type = pv1 (Presen. variable1) default a
    or
    Agency Subtype = pv1 (presen. variable1) default a
    Then, it works.
    But, I need Multi select prompt. And, i cannot use p.v for multi select.
    How to acheive the above functionality.
    Experts, Please guide me.....

    If I'm Using And Condition it fails.
    Because,
    Say I have Types as - Type1, Type2
    Say I have Subtypes as - Subtype1, subtype2, subtype3
    Type table
    Type1, subtype1
    Type1, subtype2
    Type2, Subtype3
    Now, if select prompt1 ( Prompt1 is prompted -> Type1 is prompted) ----> My report reflects for type1
    if I Select prompt2 (Prompt2 is prompted -> Subtype3 is prompted) -----> My Report reflects for subtype3
    If i use here And ----> it fails ( Type = Type1 and Subtype = Subtype3)
    It should be Or ----> (Type = Type1 or Subtype = Subtype3) ----> this passes only when i select both values. But, my requirement is it should pass for even one selection.
    It can be done for drill down and pres. variable. But, my requ. is multiselect.

  • Update empty row / column values

    here is the sample data
    Col_1 -- col_2-----col_3-------col_4------col_5------col_6
    9--------111---------45-----------21
    7--------877
    2--------456
    8--------765
    I am trying to update the col_3,col_4,col_5,col_6 like
    Col_1 -- col_2-----col_3-------col_4------col_5------col_6
    9--------111---------45-----------21--------4654------6534
    7--------877---------67-----------42
    2--------456---------845----------4563
    8--------765
    How to insert/update the col_3,Col_4,Col_5,col_6 by adding values in sequence, I want insert the values in 2nd row then 3rd row etc.
    how to select next empty row of the particular column without including the other column values in where condition.
    Using ROWNUM or ROWID it's possible selecting the next row of the particular column ?
    Thanks in advance.

    following query i use for something:
    with
    week1 as (select decap as decap_w1,desrvid as desrvid_w1 from drdiskspace where deweek = to_char(sysdate,'WW')-1),
    week2 as (select decap as decap_w2,desrvid as desrvid_w2 from drdiskspace where deweek = to_char(sysdate,'WW')-2),
    week3 as (select decap as decap_w3,desrvid as desrvid_w3 from drdiskspace where deweek = to_char(sysdate,'WW')-3),
    week4 as (select decap as decap_w4,desrvid as desrvid_w4 from drdiskspace where deweek = to_char(sysdate,'WW')-4),
    week5 as (select decap as decap_w5,desrvid as desrvid_w5 from drdiskspace where deweek = to_char(sysdate,'WW')-5),
    week6 as (select decap as decap_w6,desrvid as desrvid_w6 from drdiskspace where deweek = to_char(sysdate,'WW')-6),
    week7 as (select decap as decap_w7,desrvid as desrvid_w7 from drdiskspace where deweek = to_char(sysdate,'WW')-7),
    week8 as (select decap as decap_w8,desrvid as desrvid_w8 from drdiskspace where deweek = to_char(sysdate,'WW')-8),
    week9 as (select decap as decap_w9,desrvid as desrvid_w9 from drdiskspace where deweek = to_char(sysdate,'WW')-9),
    week10 as (select decap as decap_w10,desrvid as desrvid_w10 from drdiskspace where deweek = to_char(sysdate,'WW')-10)
    select desrvnaam || ' ' || desrvschijf, decap, decap_w1, decap_w2, decap_w3, decap_w4, decap_w5, decap_w6, decap_w7, decap_w8, decap_w9, decap_w10
    from drdiskspace, drserver, week1, week2, week3, week4, week5, week6, week7, week8, week9, week10
    where drdiskspace.deweek = to_char(sysdate,'WW')
    and drdiskspace.desrvid=drserver.desrvid
    and drdiskspace.desrvid=desrvid_w1
    and drdiskspace.desrvid=desrvid_w2
    and drdiskspace.desrvid=desrvid_w3
    and drdiskspace.desrvid=desrvid_w4
    and drdiskspace.desrvid=desrvid_w5
    and drdiskspace.desrvid=desrvid_w6
    and drdiskspace.desrvid=desrvid_w7
    and drdiskspace.desrvid=desrvid_w8
    and drdiskspace.desrvid=desrvid_w9
    and drdiskspace.desrvid=desrvid_w10
    and drdiskspace.desrvid=:P200_ZOEK;
    greatz,
    Jan Louis

  • Display hperlink in report based on column values

    Hi,
    I have a requirement to make report column as hyperlink column with the condition that
    1 . If report column values is 0 then on '0' hyperlink should not display.
    2 . In other values hyperlink should display.
    Please help me to achive this.
    Thanks & Regards,
    Priya

    select decode ( col1, 0, null, '{a href="f?p=&APP_ID.:XX:'||'&SESSION.'||'::::ID:'||col1||':YES" }Go{a}' as Link, col2, col3 from table
    XX is your linked page number.
    Replace { to <
    and
    } to >

  • HTML code for Column value formating.

    Hi All,
    We have a requirement that, in a report we have some column values. For one of the column value we need to show that in bold with boarder like
    Column1| Column2| Column3.....
    Val1 | Val2 | Val3
    Val4   | Val5       | Val6_
    we want to show val4 column as bold and with boarder, because of some other constraints we have to use pivot table view. How can we achieve that
    Thanks in advance.

    Criteria tab->Column Properties->Style
    For Border you can use Style->Border
    You wold have mention entire row instead of vlo4!!
    If you have any condition to identify the row then go with conditional format
    Edited by: Veeravalli on Nov 26, 2012 7:01 AM
    Edited by: Veeravalli on Nov 26, 2012 7:03 AM

Maybe you are looking for