Only else statement works

Morning,
Would someone please look this over? I can't seem to get it to work properly. What I am trying to do is insert the substr into another table if it is found otherwise insert a default date. Right now only the default date is inserting into the table temphone1 for every row even though there are many strings that should have been also inserted.
oracle 11g redhat linux.
declare
cursor c_1 is
select * from raw_data
where rownum < 500;
begin
for c_rec in c_1
loop
if regexp_substr(c_rec.date_time,'^(0?[1-9]|1[0-2])/(0?[1-9]|[1-2][0-9]|3[0-1])/([[:digit:]]{4})') is not null
then
update temphone1 set new_time= regexp_substr(c_rec.date_time,'^(0?[1-9]|1[0-2])/(0?[1-9]|[1-2][0-9]|3[0-1])/([[:digit:]]{4})');
else
update temphone1 set new_time = to_date('23/NOV/2008','DD/MON/YYYY');
end if;
commit;
end loop;
end;
Thank you in advance that you can give me.
regards,
al

Hi, Al,
afaltyn wrote:
Morning,
Would someone please look this over? I can't seem to get it to work properly. What I am trying to do is insert the substr into another table if it is found otherwise insert a default date. Right now only the default date is inserting into the table temphone1 for every row even though there are many strings that should have been also inserted.
oracle 11g redhat linux.
declare
cursor c_1 is
select * from raw_data
where rownum < 500;
begin
for c_rec in c_1
loop
if regexp_substr(c_rec.date_time,'^(0?[1-9]|1[0-2])/(0?[1-9]|[1-2][0-9]|3[0-1])/([[:digit:]]{4})') is not null
then
update temphone1 set new_time= regexp_substr(c_rec.date_time,'^(0?[1-9]|1[0-2])/(0?[1-9]|[1-2][0-9]|3[0-1])/([[:digit:]]{4})');
else
update temphone1 set new_time = to_date('23/NOV/2008','DD/MON/YYYY');
end if;
commit;
end loop;
end;
/Never write, let alone post, unformatted code.
Indent the code to show the scope of statements such as BEGIN, LOOP and IF.
When posting any formatted text (not just code) on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
If you're asking about a DML statement, such as UPDATE, the CREATE TABLE and INSERT statements should re-create the tables as they are before the DML, and the results  will be the contents of the changed table(s) when everything is finished.
Always say which version of Oracle you're using.
Is temphohne1.new_time a DATE?  If so, don't try to assign a VARCHAR2 value to it, like you're doing here:update temphone1 set new_time= regexp_substr(c_rec.date_time,'^(0?[1-9]|1[0-2])/(0?[1-9]|[1-2][0-9]|3[0-1])/([[:digit:]]{4})');
Is temphohne1.new_time a VARCHAR2?  If so, don't try to assign a DATE value to it, like you're doing here:update temphone1 set new_time = to_date('23/NOV/2008','DD/MON/YYYY');
You probably want to add WHERE clauses to both UPDATE statements.  As posted, each of them is updating every row in temphone1.  Perhaps you want something likeUPDATE temphone1
SET      new_time = '23/NOV/2008'     -- Assuming new_time is a string
WHERE     column_1 = c_1.column_a;

Similar Messages

  • Only select statements work (update/insert hang)

    Hi, I am running CF MX version 7,0,2,142559 Standard Edition
    and ColdFusion is hanging everytime I attempt an insert or update
    statement again Oracle 8i and 9i using the jdbc thin driver and an
    odbc socket driver.
    Select statements work fine. I have tried everything I could
    think of and I get the same results. All rights are given to the
    datasource and the user. I can do insert and update statement via
    another application (Toad) with the same Oracle user.
    Any suggestions??? I don't see any hot fixes for this but
    that doesn't mean one doesn't exist.
    Also, many times it causes the system cpu utlization to stick
    at 100% until I restart ColdFusion.
    Thanks for any help.

    Hi,
    I had similar results on Oracle 10G while using cfmx 7.02. I
    actually updated the macromedia_drivers.jar from the coldfusion
    support site.
    http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=42dcb10a
    An update to the datadirect JDBC drivers. Try that. If not,
    make sure you have the latest JDBC drivers from Oracle. Since
    previous versions would make the update/insert;s hang.

  • IF ELSE Statement in BEx Query based on the results

    Hi experts,
    I want to realize the following IF/ELSE statement in a BEx Query in respect to the result values
    If the result of KF1 equals 0, than set the KF2 to 0, Else (KF1 NE 0) show the value of KF2
    Background: I want to report the order backlog. In the example above we have an incoming order value of 23.700,80 EUR in periode 12.2013 and an turnover of 22.370,80 EUR in periode 01.2014. The order backlog in ST (KF1) is 1 ST (12.2013) - 1 ST (01.2014) = 0 ST. The order backlog in EUR (KF2) is 23.700,80 EUR (12.2013) - 22.370,80 EUR (01.2014) = 1.330 EUR. The Order and Invoice is finished, but we have an positive order backlog in EUR (reason: less turnover as incoming order).
    For this case I want to realize the IF/Else statement to check if the oder backlog in ST = 0, if yes, than set the order backlog in EUR also to 0.
    Any best practices?
    Many thanks and best regards,
    Michael

    Hi Suman,
    thanks aigain for your reply!
    I have tried your proposal before you have posted it.
    In my special case the following if/else statement works successfully:
    CKF = calculated key figure
    Formula1 = (CKF1 == 0) * 0 + (CKF1 <> 0) * CKF2
    In my case the CKF2 is the result value from "Incoming Order value" - "Turnover"
    So I had to define a separate Formula (1:1 equals to CKF2) and then I was able to set "*CKF2" in the statement.
    The statement CKF2 = (CKF1 == 0) * 0 + CKF2 is not possible (because it´s not possible to calculate from CKF2 itself).
    Now it works
    Best regards,
    Michael

  • When I am in firefox and I go to google and click on a link, it pops up as something else randomly. The only way it works is by coping the link into address bar

    When I am in firefox and I go to google and click on a link, it pops up as something else randomly. The only way it works is by coping the link into address bar. I thought it might be google so I went to bing and it did the same thing. it will not go to the link but instead change to livesearchnow or ihavenet.com
    It is really a pain as I search google ALOT. So please someone help. I reset firefox once and even reinstalled it once as well as updated it once. Nothing works.

    Do a malware check with some malware scanning programs on the Windows computer.<br />
    You need to scan with all programs because each program detects different malware.<br />
    Make sure that you update each program to get the latest version of their databases before doing a scan.
    *http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    *http://www.superantispyware.com/ - SuperAntispyware
    *http://www.microsoft.com/security/scanner/en-us/default.aspx - Microsoft Safety Scanner
    *http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    *http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    You can also do a check for a rootkit infection with TDSSKiller.
    *http://support.kaspersky.com/viruses/solutions?qid=208280684
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked

  • HT1349 my phone keeps freezing on settings, I cannot make or receive a call but everything else is working including internet and mail. where it should be showing the reception bars it is only showing a broken line. How do I resolve this?

    my phone keeps freezing on settings, I cannot make or receive a call but everything else is working including internet and mail. where it should be showing the reception bars it is only showing a broken line. How do I resolve this?

    If you are not showing reception bars, then I don't know how the data is working? Have you tried doing a reset? Hold the sleep/wake and home buttons together until you see the Apple logo and then release. After the phone restarts, check to see if it works. If that doesn't help, then try removing the SIM card, then reinserting it. If that doesn't help, then contact your carrier for assistance in calling.

  • How can I use an IF ELSE statement and the xdoxslt: get_variable together?

    First of all, I'm a big fan of this forum and I just want to thank the community for helping make the BI Publisher world a better place.
    I'm trying to populate a table with a years worth of data with the column=PRODUCT and row=month of DATE. Here's the catch, not all of the months will have data. So here's where my problem is, I'm not able to use an IF ELSE statement along with a XDOXSLT:GET_VARIABLE expression so that if there's no data for that month the default value will be 0.
    Can someone help me find a solution to either one of the attempts below or a completely new method? Thanks!
    BP4 = numeric month value using DATE (more code to pull only month from DATE not included here)
    JAN1 = PRICE if data exists, else 0
    1) I tried this and it didn't work:
    <?if: xdoxslt:get_variable($_XDOCTX,'BP4'),01 then xdoxslt:set_variable($_XDOCTX, 'JAN1',PRICE) else xdoxslt:set_variable($_XDOCTX, 'JAN1',0) end if?>
    <?xdoxslt:get_variable($_XDOCTX,'JAN1')?>
    <?end if?>
    2) I tried this and it didn't work:
    <?xdoxslt:ifelse(xdoxslt:get_variable($_XDOCTX,'BP4')='01',xdoxslt:set_variable($_XDOCTX, 'JAN1',PRICE),xdoxslt:set_variable($_XDOCTX, 'JAN1',0))?>
    <?xdoxslt:get_variable($_XDOCTX,'JAN1')?>
    <?end if?>
    3) I tried this and it didn't work:
    <?xdofx:if xdoxslt:get_variable($_XDOCTX,'BP4')='01' then xdoxslt:set_variable($_XDOCTX, 'JAN1',PRICE) else xdoxslt:set_variable($_XDOCTX, 'JAN1',0) end if?>
    <?xdoxslt:get_variable($_XDOCTX,'JAN1')?>
    <?end if?>
    sample XML:
    <ROW>
    <Name>Craig Hernandez</NAME>
    <DATE>2013-01-01T00:00:00.000+08:00</DATE>
    <PRICE>31</PRICE>
    <PRODUCT>BPD</PRODUCT>
    </ROW>
    -DrT
    Edited by: 990965 on Feb 28, 2013 8:27 AM

    let me clarify my logic, the template 1) searches for the relevant PRODUCT (in the case below, it searches for BPD which is the column in the table) 2) searches for the relevant month in DATE (which is the row in the table) 3) if data exists, get PRICE else default to 0
    Variable definitions:
    BP4 = numeric month value from DATE (more code to get this value not included here, but it works...)
    JAN1 = set to PRICE if data exists for that month, else 0
    the query is only pulling all of the existing data, so if there's no data for March then there wouldn't be a March entry in the xml. In the sample xml below, we only have data for the first two months (Jan, Feb) so that's the only data in the xml. I can't check if PRICE is null because the xml will not have any data for March.
    I've read through other threads and it seems that BI Publisher can't use an IF THEN ELSE with the XDOXSLT:GET_VARIABLE. I sent the template and xml to you.
    Sample XML:
    <ROW>
    <Name>Craig Hernandez</NAME>
    <DATE>2013-01-01T00:00:00.000+08:00</DATE>
    <PRICE>31</PRICE>
    <PRODUCT>BPD</PRODUCT>
    </ROW>
    <ROW>
    <Name>Craig Hernandez</NAME>
    <DATE>2013-02-01T00:00:00.000+08:00</DATE>
    <PRICE>30</PRICE>
    <PRODUCT>BPD</PRODUCT>
    </ROW>
    Edited by: 990965 on Feb 28, 2013 8:30 AM

  • Timer event doesn't listen to my if else statements how do stop it?

    So I'm building a random generator of just a vector that i imported into flash and everything works just fine, almost. I added a timer to the creation of the vector. I also have some if else statements that are going to govern User Input. I realized that if the UI was initially outside of the parameters i've set it runs fine but once the once the function with the timer starts it never stops regardless of whether or not the UI is in the parameters I set. How do I stop the function when the UI is not what i want it to be?
    Heres my code:
    //initial universal variable declaration
    var kface:Kobbyface;
    var UI:Number;
    var kfacex:Number;
    var kfacey:Number;
    var UIold:Number = 0;
    var timer:Timer = new Timer(200);
    //background rectangle
    graphics.beginFill(0xFFFF00, 1);
    graphics.drawRect(0,65, stage.stageWidth, stage.stageHeight);
    graphics.endFill();
    trace (inputnumber);
    //eventlistener for click
    gobutton.addEventListener(MouseEvent.CLICK, create);
    function create(me:MouseEvent):void {
    UI = Number(inputnumber.text);
    if (isNaN(UI)) {
    errormessages.text = "Kobby only responds to numbers"
    else if (UI > 500) {
    errormessages.text = "You're not ready for that many Kobbys"
    else if (UI < 15) {
    errormessages.text = "Come on you can handle more than that"
    else{
    createfaces();
    //for loop///
    function createfaces ():void {
    ////////timer for face animation///////
    timer.addEventListener(TimerEvent.TIMER, animate);
    timer.start();
    function animate(evt:TimerEvent):void {
    /////keep track of old number/////
    if (UIold != 0) {
    for (var i: int = 1; i<UIold + 1; i++) {
    stage.removeChildAt(1);
        /////assign old number to new number////
    UIold = UI;
    for ( var i:int = 1; i<UI + 1; i++ ) {
    trace( i );
    ////assign values to coordinate varialbes/////
    var kfacex:Number = Math.random() * stage.stageWidth;
    var kfacey:Number = Math.random() * stage.stageHeight + 65;
    //creation of faces///
    kface = new Kobbyface();
    stage.addChild(kface);
    kface.x = kfacex;
    kface.y = kfacey;

    you can apply the stop() method to your timer:
    timer.stop();

  • Best way to test each if else statement

    Hey everyone I have a few scripts that have many different if ,elseif, else blocks. The problem is that they are hard to test and some are rarely triggered. However I need to check to make sure the contents triggered by one of the statements works. I know
    there is a whatif switch but from my understanding it is only used for specific commands and doesn't actually trigger them. 
    So is there some way to debug them or force the script to meet a condition of an if statement?
    Thanks for any help!!

    Hi,
    I generally put a Write-Output in each branch that will tell me where I am. Here's an example:
    $trigger = 1
    If ($trigger -eq 1) {
    Write-Output 'Found #1'
    } ElseIf ($trigger -eq 2) {
    Write-Output 'Found #2'
    } ElseIf ($trigger -eq 3) {
    Write-Output 'Found #3'
    } Else {
    Write-Output 'Found something else'
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • If else statement

    hi everyone
    i need help
    I'm trying to make if else statement in the sqldeveloper query
    and my code us like ...
    IF CHARGE_PRICE BETWEEN 10000 AND 20000
    THEN
    charge_apartment(1,600);
    ELSIF CHARGE_PRICE BETWEEN 20000 AND 40000
    THEN
    charge_apartment(1,500);
    ELSIF CHARGE_PRICE > 40000
    THEN
    charge_apartment(1,900);
    ELSE
    charge_apartment(1,650);
    END IF;
    now the question is how do i cover that part of code so the sqldeveloper query will know that I'm talking about an Apartments table...?
    I dig around the net and so far all the info i got is relevant only for sql*Plus
    so...
    How can I do this at the query?
    thanks in advance
    Edited by: 885780 on Sep 16, 2011 4:04 PM
    Edited by: 885780 on Sep 16, 2011 4:05 PM

    I'll explain myself again more clearly
    if i', execute the command
    execute Charge_Apartment(1,600)
    so the right apartment is being charged with the right peice,
    But!
    if i'm execute
    CASE
    WHEN APARTMENT_SIZE < 10000 THEN Charge_Apartment(1,650);
    WHEN APARTMENT_SIZE < 20000 THEN Charge_Apartment(1,600);
    WHEN APARTMENT_SIZE < 40000 THEN Charge_Apartment(1,500);
    ELSE Charge_Apartment(1,900);
    END
    I'm crashing with
    Error starting at line 1 in command:
    CASE
    Error report:
    Unknown Command
    Error starting at line 2 in command:
    WHEN APARTMENT_SIZE < 10000 THEN Charge_Apartment(1,650)
    Error report:
    Unknown Command
    Error starting at line 3 in command:
    WHEN APARTMENT_SIZE < 20000 THEN Charge_Apartment(1,600)
    Error report:
    Unknown Command
    Error starting at line 4 in command:
    WHEN APARTMENT_SIZE < 40000 THEN Charge_Apartment(1,500)
    Error report:
    Unknown Command
    Error starting at line 5 in command:
    ELSE Charge_Apartment(1,900)
    Error report:
    Unknown Command
    Error starting at line 6 in command:
    END
    Error report:
    Unknown Command
    If someone can help me i'll be glad
    Thanks in advance 4 all of you who helped so far ...

  • IF ELSE statement / CMOD Code in BEX Query

    Hi
    I have a requirement in Inventory flow.
    Material stock value at the end of each quarter has to be calculator based on cycle count indicator. I have all the values on my cube.
    In the report, Calender year and quarter is on the selection screen.
    When user enters 2014 and Q2, Data for April, May and June are displaying on the report. But user want data only for June.
    At the end of quarter 2 is June, so he wants only Material stock value at the end of June.
    If a material stock level is changed in April and May and not changed in June, not data is available for June in my Cube.
    In this case for Quarter 2, if June data is missing, it has to look for May data. Even if MAY data is missing, it will have to look for April.
    Even if April data is missing, it will have to look for March data.
    The result should be
    Plant    Q1    Q2    Q3   Q4
    XYZ     100    100  100    100
    If there is no change to stock level in April, May & June - at the end of Quarter 2, the stock value should be 100 as it was in end of Q1.
    If no change was dont to stock level until December, the stock level should be 100.
    Is there a way out using IF ELSE statements or through CMOD customer exit.
    Regards,
    Elango Murgesan

    HI Elango,
    the user input on CALQuarter always would be Single value??or can we expect ranges as well?
    if single value,
    then we can achieve it by having one more dummy KF.
    lets say. user input is Q2. 
    -> in your dummy KF, restrict the Calquarter/Calmonth to last quarter(i.e Q1)using customer exit and make the logic as you said above(last value based on calmonth).(make this KF hidden, as this is not required to display)
    -> and in another KF restricted with Q2.Same logic, last value on Calmonth.((make this KF hidden, as this is not required to display)
    and now you have 2 KFs in your report.  So in a formula, you can have condition-> if Q2 KF is blank, then Q1KF, else Q2 KF.
    Hope you are getting my idea.. Please try this and let us know.
    ** if Q1 also null, then we can extend customer exit logic to may be last one year, and having last value on based on calendar month, we can still achieve i guess.
    Regards,
    Sakthi.

  • Looking for a best query for multiple IF Else statement in a single select

    Hi
    I want to run multiple IF Else statements in a single select SQL, each statement is one SQL operating on the same table, what is the best way to write this select SQL query ?
    If it is PL/SQL, when i get the result from the first IF statement I will skip the remaining execution, and so on... Can any one help me on this.
    Thanks in advance !!

    965818 wrote:
    I Apologize, the information i have given might not be enough.
    This is my scenario,
    I am selecting set of rows from the table for the employee id. After selecting those records,
    i need to go through the result list and check the condition 1, if it is met, i will return that employee record.
    If that condition 1 is not met, then i need to go through the condition 2. If that is met, i will return that record.
    Like wise, i have four conditions.
    I am trying to achieve this in a single sql. If i am not clear, please let me know.Not fully clear yet, but the picture is better already. The thing with SQL is that you should stop thinking procedurally. Instead think in data sets.
    For example if the task is:
    Find all managers that work in sales.
    Procedural thinking would work like this:
    pseudo code
    Loop over all employees that work in sales
       for each row
           check if it is a manager
               if manager
                  then return record
               else
                  do nothing
               end
    end loopThinking in datasets will result in a different logic
    pseudo code
    select all employees
    where department = SALES
    and job = MANAGERThis advantage here is that all the "Do nothing" loops are not needed. Those are already eliminated by the database.
    So what is needed to help you? Give the full picture. What is your task that you try to solve. From a business perspective.

  • If..then..else statement in SQL with 'generalized' conditions in the if sta

    it is possible to write something approaching an if..then..else statement in SQL with 'generalized' conditions in the if statement.
    Attached is the query for the payment register, in which I've written a series of decode statements, one for each possible value of the payment code. The query works OK - however, its specific and as the number of paycodes expand (and they do), the report won't pick up the new paycode until the code is changed. More importantly, the report won't be correct until someone 'discovers' that a paycode is missing, which might take months.
    If I were writing the equivalent of this series of decode statements in Focus, it would be something like this:
    DEFINE.......
    PAYMED/D12.2 = IF PAYMENT_CD LE 18
                   THEN PAYMENT_AMT
                   ELSE 0 ;
    PAYIND/D12.2 = IF PAYMENT_CD GE 19 AND PAYMENT_CD LE 49
                   THEN PAYMENT_AMT
                   ELSE 0 ;
    PAYEXP/D12.2 = IF PAYMENT_CD GE 70
                   THEN PAYMENT_AMT
                   ELSE 0 ;
    PAYREC/D12.2 = IF PAYMENT_CD GE 50 AND PAYMENT_CD LE 69
                   THEN PAYMENT_AMT
                   ELSE 0;
    END
    IN SQL/PLUS:
    SELECT ACCOUNT_NAME,
    LOCATION_1,
    CLMNT_LAST_NAME,
    CLAIM_NBR,
    DATE_OF_INJURY,
    DATE_CHECK_REGISTER,
    PAYEE_NAME_1,
    PAYMENT_CD,
    SERV_OFC,
    CPO_CHECK_NBR,
    PAYMENT_FORM,
    DECODE(PAYMENT_CD, 20, PAYMENT_AMT, 21, PAYMENT_AMT,
    22, PAYMENT_AMT, 23, PAYMENT_AMT, 25, PAYMENT_AMT,
    26, PAYMENT_AMT, 27, PAYMENT_AMT, 28, PAYMENT_AMT,
    29, PAYMENT_AMT, 30, PAYMENT_AMT, 31, PAYMENT_AMT,
    32, PAYMENT_AMT, 33, PAYMENT_AMT, 34, PAYMENT_AMT,
    35, PAYMENT_AMT, 36, PAYMENT_AMT, 37, PAYMENT_AMT,
    39, PAYMENT_AMT, 40, PAYMENT_AMT, 41, PAYMENT_AMT,
    42, PAYMENT_AMT, 43, PAYMENT_AMT, 44, PAYMENT_AMT,
    45, PAYMENT_AMT, 46, PAYMENT_AMT, 47, PAYMENT_AMT,
    48, PAYMENT_AMT, 49, PAYMENT_AMT, NULL) INDEMNITY,
    DECODE(PAYMENT_CD, 0, PAYMENT_AMT, 1, PAYMENT_AMT,
    2, PAYMENT_AMT, 3, PAYMENT_AMT, 4, PAYMENT_AMT,
    5, PAYMENT_AMT, 6, PAYMENT_AMT, 7, PAYMENT_AMT,
    8, PAYMENT_AMT, 9, PAYMENT_AMT, 10, PAYMENT_AMT,
    11, PAYMENT_AMT, 12, PAYMENT_AMT, 13, PAYMENT_AMT,
    14, PAYMENT_AMT, 15, PAYMENT_AMT, 18, PAYMENT_AMT,
    17, PAYMENT_AMT, NULL) MEDICAL,
    DECODE(PAYMENT_CD, 70, PAYMENT_AMT, 71, PAYMENT_AMT,
    72, PAYMENT_AMT, 73, PAYMENT_AMT, 74, PAYMENT_AMT,
    75, PAYMENT_AMT, 76, PAYMENT_AMT, 77, PAYMENT_AMT,
    78, PAYMENT_AMT, 79, PAYMENT_AMT, 80, PAYMENT_AMT,
    81, PAYMENT_AMT, 82, PAYMENT_AMT, 83, PAYMENT_AMT,
    84, PAYMENT_AMT, 85, PAYMENT_AMT, 86, PAYMENT_AMT,
    87, PAYMENT_AMT, 88, PAYMENT_AMT, 89, PAYMENT_AMT,
    90, PAYMENT_AMT, NULL) EXPENSES,
    DECODE(PAYMENT_CD, 50, PAYMENT_AMT, 51, PAYMENT_AMT,
    52, PAYMENT_AMT, 53, PAYMENT_AMT, 54, PAYMENT_AMT,
    55, PAYMENT_AMT, 56, PAYMENT_AMT, 57, PAYMENT_AMT,
    58, PAYMENT_AMT, NULL) RECOVERIES,
    DECODE(PAYMENT_FORM, 'N', PAYMENT_AMT, NULL) NONCASH,
    DATE_FROM_SERVICE,
    DATE_THRU_SERVICE
    FROM &INPUT_TABLES
    WHERE &SECURITYCOND
    DATE_OF_PAYMENT BETWEEN :START_DATE AND :END_DATE
    ORDER BY LOCATION_1, CPO_CHECK_NBR
    As you can see, this is both much easier to write and covers the possibility of expansion of paycodes (expansions always fit in these defined ranges).
    My question is, then, is it possible to write something like this in SQL and, if so, could you give me some sample code? (I'm one of those people who learn best from looking at the code as opposed to a set of instructions)

    Here is one way you could do it.
    Create a table that has columns like:
    Payment_code varchar2(2),
    Effective_Date Date,
    Payment_type varchar2(20),
    Expiration_Date Date)
    Payment type for example could be
    I- indemnity
    M- medical
    R- recovery
    E- expenses
    Let the table name for example be PAYMENT_CODE.
    The select query would look like
    SELECT ACCOUNT_NAME,
    LOCATION_1,
    CLMNT_LAST_NAME,
    CLAIM_NBR,
    DATE_OF_INJURY,
    DATE_CHECK_REGISTER,
    PAYEE_NAME_1,
    PAYMENT_CD,
    SERV_OFC,
    CPO_CHECK_NBR,
    PAYMENT_FORM,
    DECODE(p.payment_type,'E',PAYMENT_AMOUNT,0) expenses,
    DECODE(p.payment_type,'I',PAYMENT_AMOUNT,0) indemnity,
    DECODE(p.payment_type,'M',PAYMENT_AMOUNT,0) Medical,
    DECODE(p.payment_type,'R',PAYMENT_AMOUNT,0) recoveries,
    DECODE(PAYMENT_FORM, 'N', PAYMENT_AMT, NULL) NONCASH
    FROM &INPUT_TABLES,
    PAYMENT_CODE P
    WHERE P.PAYMENT_CODE = SOMEINPUT_TABLE.PAYMENT_CODE
    and other conditions
    The idea is to group all the payment codes into a few groups to reduce the clutter. If there is ever a change to the payment code, you could modify the table and it will be reflected in your select query.

  • How do I display AS3 Object in only one state?

    I created a AS3 object from a SWFLoader class as an animation, which I then place in a Flex stage.  I need to display the object programmatically in only one state but there is no "includeIn()" method to include it in just one state.
    Right now, it is showing up on all of the flex states.  I add this object at different times and positions in the state.  Everything is fine except it displays in all the states.
    How do I display a AS3 object in only one state?
    Thank you.

    When i use visible property as you suggested, it works, but only on one object.  I am generating more than one of these objects, so there could be 3 or 4, etc of these objects displaying concurrently at different x y positions in the state.
    Is there a way to grab all of the objects created by this AS3 class at once and apply the visible property?
    thanx

  • Inserting a 'null' value in an IF THEN ELSE statement

    Greetings,
    I'm using Business Object webi XiR3
    I'd like to return a 'null' value in certain cases for an IF THEN ELSE statement.  Depending on if I format the field as a text or a number, I can return blanks ("") and zeros (0).  However, what I really need to do is leave the field / column formatted as a number and return a 'null' value.  You can see the variable below ... this will return a blank but the column is text.
    Suggestions?
    thanks.
    variable:
    =If([Comp Rate Mid] = 0 And( ([Market Rate 50th].085) - [Annual Total Targeted Comp] >=0) ; ([Market Rate 50th]0.85) - [Annual Total Targeted Comp]; If([Comp Rate Mid] <> 0 And( ([Comp Rate Mid] 0.85) - [Annual Total Targeted Comp] >=0) ; ([Comp Rate Mid]0.85) - [Annual Total Targeted Comp];""))

    I don't think this is possible using a formula, as formulas deal with content, and images can be placed in cells only as 'image fill', which is Format, rather than Content.
    Might be possible using an AppleScript, but I'm not the person to advise you on that.
    Regards,
    Barry

  • Select statement works in 8.1.5  but does not work in 8.1.7 why???????

    I have written a select statement as part of cursor in a
    Database Trigger, the following statement works fine in Oracle
    8i ver 8.1.5.0 but the same statement returns error PLS-00103
    (Parser related error) in Oracle 8i version 8.1.7.0!!!!!!
    The error shown is
    PLS-00103Encountered the symbol")" when expecting one of the
    following:
    from
    The Sql statement in a Database Trigger is as follows
    select opn_stk,iss_qty,rec_qty,ROWID
    from mnth_bal
    where to_date(lpad(to_char(month),2,'0')||to_char
    (year),'mmyyyy') >= SYSDATE AND
    REV_NO = :NEW.REV_NO AND
         ITEM_STOCK_ITEM_CD = :NEW.ITEM_CD and
    unit_cd = :NEW.unit_cd and
    store_cd = :new.store_cd
    order by to_date(lpad(to_char(month),2,'0')
    ||to_char(year),'mmyyyy') ;
    Can any one please tell me whats the problem ? In 8.1.5.0 the
    same statement in the trigger runs absolutely fine &
    compiles.Because of this problem the trigger is not compiling in
    8.1.7.0
    Would be grateful for any solutions given

    Relating line numbers in compile errors to source code.
    Oracle does not count blank lines in line numbers. Commenting
    with "--" blank lines or deleting blank lines will make the line
    counter more accurate.
    Oracle counts comments delimited with /*...*/ as one line, no
    matter how many lines are in the source code. Using only "--"
    will make the line counter more accurate.
    Oracle does not count lines before the PL/SQL block DECLARE when
    compiling triggers. (CREATE ... TRIGGER....FOR EACH...WHEN(...))
    parts of the syntax are not counted. The line in the source
    code with the DECLARE of the trigger's PL/SQL block will be line
    1.
    Hint: Avoid uncertainty. Use "SHO ERR TRIGGER <trigger_name>"
    when looking at compile problems.
    Good Luck....

Maybe you are looking for

  • CS2 won't run

    CS2 won't run, says activation code no longer usable. Been running win7 on this system 3 years. Adobe says it won't activate in win7. Well, it did, and ran just fine. what's up?

  • What's wrong with my multiArray?

    Ok the code as below, what's wrong with it? why doesn't the array fill up across the rows? there are meant to be some nulls, cos it has 5 columns and 8 rows, and things like add will not fill the width but something is not right cos I get loads of nu

  • I have restore my phone and i have treid to redownload my purchased but it saying my account has been disabled so what do i have to do?

    i have restore my phone and i have treid to redownload my purchased but it saying my account has been disabled so what do i have to do?

  • IPOD TOUCH AND HOME STEREO

    All, New to the board. I have an Ipod Touch, and wanted to play it through my home stereo which is a Denon, and has the Aux outputs in the front. There is a Video - aux, and 2 slots for audio. I went and bought the cable that indicated for IPOD (Touc

  • WLS 8.1 SP2

    Is it possible to download just the servicepack, like you could do back withWLS 6.1? Or do you have to download the whole server?