What is the correct way to automatically restart a failed Service?

When / how I should restart a failed javafx.concurrent.Service?  I have an exception handler that is Worker.State of the Service and restarts the Service if an exception is handled successfully.  Observers who are saved before the error handler see a lifecycle for the worker while observers registered after the error handler see a different life cycle.  Here is an example of what I mean:

import javafx.application.Application;
import javafx.application.Platform;
import javafx.concurrent.Service;
import javafx.concurrent.Task;
import javafx.concurrent.Worker;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;


public class RetryingServiceExample extends Application {
    private int retryCount = 1;


    @Override
    public void start(final Stage primaryStage) throws Exception {
        String osName = System.getProperty("os.name");
        String javaVersion = System.getProperty("java.version");
        String vmInfo = System.getProperty("java.vm.version") +
                " (" + System.getProperty("os.arch") + ")";


        System.out.println("OS: " + osName);
        System.out.println("Version: " + javaVersion);
        System.out.println("VM Info: " + vmInfo);
        System.out.println("----------------------------------------");


        Service<Void> service = new Service<Void>() {
            @Override
            protected Task<Void> createTask() {
                return new Task<Void>() {
                    @Override
                    protected Void call() throws Exception {
                        if(retryCount > 0) {
                            retryCount--;
                            throw new Exception("Fake exception");
                        }
                        return null;
                    }
                };
            }
        };


        final StringBuilder sb1 = new StringBuilder("#1...\r\n");
        service.stateProperty().addListener((o, old, newState) -> {
            sb1.append(old).append(" --> ").append(newState).append("\r\n");
        });


        service.stateProperty().addListener((o, old, newState) -> {
            if(newState == Worker.State.FAILED) {
                service.restart();
            }
        });


        final StringBuilder sb2 = new StringBuilder("#2...\r\n");
        service.stateProperty().addListener((o, old, newState) -> {
            sb2.append(old).append(" --> ").append(newState).append("\r\n");
        });


        service.start();


        Button close = new Button("Close");
        close.setOnAction(event -> {
            System.out.print(sb1.toString());
            System.out.println();
            System.out.print(sb2.toString());
            Platform.exit();
        });
        primaryStage.setScene(new Scene(close));
        primaryStage.show();
    }


    public static void main(String[] args) {
        launch();
    }
}

There will be no output until you click Close.  Here is the result:

OS: Windows 8.1
Version: 1.8.0_05
VM Info: 25.5-b02 (amd64)
----------------------------------------
#1...
READY --> SCHEDULED
SCHEDULED --> RUNNING
RUNNING --> FAILED
FAILED --> CANCELLED
CANCELLED --> READY
READY --> SCHEDULED
SCHEDULED --> RUNNING
RUNNING --> SUCCEEDED

#2...
READY --> SCHEDULED
SCHEDULED --> RUNNING
FAILED --> CANCELLED
CANCELLED --> READY
READY --> SCHEDULED
RUNNING --> SCHEDULED
SCHEDULED --> RUNNING
RUNNING --> SUCCEEDED

I find life a lot easier to reason about junior.  It is the cycle of life I expected to get by restarting Service method practice failed() because, according to the JavaDoc, it has the same effect that is assured to be the last wise listener.  See my related bug report:

https://JavaFX-JIRA.Kenai.com/browse/RT-36771

I find the second cycle of life more difficult to follow, but it's the only behavior I can get without using Platform #runLater (.) to restart the Service.  I can't quite yet reason on how the transition from EXECUTION to FAILURE becomes hidden.

Using Platform #runLater (...) when you restart the Service in the most reliable way to get the behavior I prefer?  Is it possible to use Platform #runLater (...) to get to the back of the queue like that?  Is it OK to restart a Service from a listener of the Worker.State or is it something that should be avoided?

Martin has responded to this in the bug report:

Let's not the example of the forum. You're basically a (State) property is changed on the inside it's listener property, i.e. the listeners will get notified when it has been changed to a completely different State. This should be avoided and the best way to do so is Platform.runLater ().

Tags: Java

Similar Questions

  • What is the correct way to load e-books in the library?

    I am a new user of ADE and am not sure how to properly load eBooks into the library.

    When I download a book from my local library, it loads the files in my personal folder and then I have to "drag" and "drop" of one of them in the library of the ADE so he can appear and then be loaded into the library.

    What is the right way for the operating system? I was expecting that downloads would go directly to the library without me manually. Or did I do something wrong with the initial installation?

    If this is the case, I would be able to start by deleting the program and re-install?

    Bravo and thank you for your time,

    taurus123

    Edit 1 has finally given me the answer - until now, I was 'save' files - realize now it's the incorrect option.

    Downloaded another eBook properly from my local library - I feel really stupid when the solution was so easy. Thank you frustrated to AZ to take the time to answer my problem.

    I read a book by ADE and I would just say that Adobe got a great product here - it is very impressive.

    Bravo and thank you.

    taurus123

    Edit: I was typing at the same time that frustrated in AZ - now everything seems to be okay If I have future problems, I will call back to the forum.

    Thank you.

  • What is the correct way or better to manage your site files according to the folder of your site?

    I apologize if this seems to be a silly question but I'm still having trouble getting my head around the management of files when using dreamweaver. I know that I am supposed to create a root folder that I created on my desktop. All of my sites that I have here in create in dreamweaver go to sub files in this main file or am I supposed to have several root file?

    Ive assumed I create a single up to that point. However I have other questions... for example when I create a fluid grid site I go through the steps of creating first my folder under this new site in my account from the main root for dreamweaver, save my css inside file when asked, and then I save the html file main Sub ' save under ' as well... However, as you know, creates then two files separate, 'catch-all' and 'response' but instead of placing them in my folder of pennies for this site, he places them in the root file instead of in the subfolder that is located in the file root (if necessary). If I manually move them to the sub folder to keep things tidy this will mess up my files? Dreamweaver will be able to go to search folder under rather than the file root where he keeps putting automatically their?

    Or I have the complete wrong end of the stick to understand how to make the management of the work all together?

    Any help greatly appreciated

    Ed

    OK so just to clarify. Each site actually has its own root folder and simply for the love of the organizations you place all of your files to the root of each site in a larger folder which in your case is called 'sites '.

    Exactly that.

    My confusion is that dreamweaver seems to have everything automatically create new site, I try to go in a root folder, I created a site earlier. That's why I guess you don't have that one folder root and all of your different sites exist within of the it.

    Ignore this. I see sometimes that happens as well. But because you browse to find the folder new root of the site in any case, it is imminent can be ignored!

    -I created a new folder outside of dreamweaver on my desk first who must accommodate all that documents sites. I was the creation of each new folder in what I thought, it's the main single root for dreamweaver folder that was on my desktop up to this point.

    There is no "single root for dreamweaver folder. As you might have guessed, each site has its own root folder and root each folder contains * all * files that make up this particular site. ***

    -J' then I open dreamweaver and will create a new site layout fluid grid

    -He asks me to save my css somwhere... I save in my new site folder (I now know what will be the root folder of my sites that each website has its own root folder)

    All my sites have a "_css" at the root folder. I precede these files with an underscore so that this and other like him (for example '_img', "_scripts", etc.) will sort together, and at the top of the list of files. This issue of _css in the root of this site, this is where I would put the stylesheet quote you. ***

    -When he opens all I go to 'file' and ' save under ' so that I can put the HTML in the document in my root folder as well. (don't forget this root folder is sitting in another folder called "root folder" but you assume I simply call 'sites' in this example.)

    So. ***

    -When I do this the html records in the folder root of the site as I hope.

    -However, dreamweaver application also my permission to create two new documents as mentioned (boilerlate and respond). Despite me trying to click the folder root of sites and it saves the documents it contains, like the rest, he saves instead what is in your folder "websites" in this example... next to the folder root of sites that i would have it should be in (not... correct me if I'm wrong)

    Well, this suggests that you have not set the root folder properly. These two files must be saved in the root of the site. If this location is not what you are talking about as the root of the site, then something is wrong.

    Why do you think that what is happening? or is it supposed to? I would have thought not myself.

    as I side question while I'm here... when I see that my css or js documents have been saved in the wrong place, as I assume they were in the example above... How can I change the location of their in dreamweaver so that dreamweaver knows where they have been moved to? I know not how to do for the HTML document main because its easily done using "save under" on the file menu, but I'm not sure how do for the other document that dreamweaver creates something like a checkerboard to fluid.

    Sorry... I'm sure it's painful for those who know how... but I'd love to get my head around things like basic

    The best way to change the location of all files used in a DW site is to use the DW files Panel to drag - move these files to the desired location. Management of DW links will kick when you do this and adjust all the existing links to these files to accommodate your move. ***

    Here is a series of images that show the process to create a new site-

    THE NEW PROCESS OF SITE

    NAME of THE SITE, THEN BROWSE to THE NEW LOCATION for THE ROOT (this image shows the starting state of those that have been done before)

    NAVIGATE TO THE FOLDER OF YOUR NEW SITE WILL BE CREATED IN WHICH

    BY CLICKING THE NEW FOLDER OPTION, YOU CREATE THE NEW SITE ROOT FOLDER AND THEN CHOOSE IT

    I CREATED TWO NEW FILES IN THE ROOT FOLDER THAT WILL HOST MY CSS AND IMAGES RESPECTIVELY

    After SELECTING THE NEW ROOT FOLDER of the SITE AND clicking 'Choose' I SEE THE DIALOGUE START WITH THE path box to ACCESS CORRECT WORMS CE FOLDER ROOT IN THE FIELD RECORD of SITE LOCAL

    I hope that helps!

  • What is the correct way to cacheasbitmap during the animation on the timeline

    After finishing animations, I find that each keyframe has the empty instance field so I have to fill in the instance that was appointed at the beginning of the animation.
    is this normal? When I declare this instance to cacheasbitmap is cached each new keyframe because he thinks that there's a new ancestral instance? or he will hide once and then use that for each keyframe that follows, the animations include a static image moving around the screen in the classic tweens.

    also should I use graphic symbols instead of movieclips? for 100 + things that need to be cached? I hear the symbols graphics are much more effective, and movieclips, but I don't know any other way to cacheasbitmap with a graphic symbol, it won't let me assign an instance nom.s there no matter what other shades or im missing details or hurt when using this feature? I have an amount of me of vector art that is cached at the beginning of the level, and so far it works well but far to be perfect. I just want to make art more efficient

    DKNMSIS wrote:

    Thank you d ' attribute, I think I'm just getting hung up on your defination of evolution of frameworks.

    so the movieclip that must be cached should not have any animation on the timeline, it should just be an image. and the animation should be inside the movieclip with the specified parent as cacheasbitmap single-frame movieclip?

    He should not have animation on its timeline, and any child movieclip must animate. If a child movieclip anime, the child must be cached (as long as there is no child that drives).

    Right now, I have my movieclips moving around and then I tell you each keyframe instance or instance in general to be cached. This is not the right way to movieclips cache is?

    I can't. It depends on how you define things upward.  for example, if you have a clip that you add to a keyframe on the main timeline and then cache, should not be cached again when you add multiple keyframes to the main timeline.

    But if you set up in any other way, you will have different instances on each key frame and you must cache all (use much more memory).

    Suppose I had a relative animation, in this case lets say a boat or something. and that boat rocking back and fourth. How I would like to acomplsh people or animation (cached) of objects to climb with the boat. This is the current situation, I am in this situation, I could make the boat stop rotation and just bob up and down so that the children are not shot or staggered, which would be the only option at this point? or is there a better way to do this.

    the deepest child should be cached, not matter which parent unless the parent has descendants who do not move and do not change somehow.  in this situation, simply caching the parent, none of the descendants children.

    on a side note, I hear the graphic symbols are much more effective. When people say that, is this just for bitmap images? the only symbol or container which allows me to provide an instance name is movieclips, would that change presence to work with graphic symbols somehow and cache as bitmaps so or it is not worth

    There is no reason to use graphic symbols never Flash unless you see the animation of symbols while rubbing the main storyline in the authoring environment.

    graphic symbols hamper the performance more than movieclips (by 10%) even without caching the movieclips.  cache of movieclip, movieclips are much more user-friendly performance.

    Allot of thanks for your help, by the way, I really appriciate it.

    You are welcome.  (p.s. Please check the useful/correct)

    on a side note this forum always mess up when I type and sends my cursor upwards and a few lines when I type maybe very 2 minutes... have you seen this before or did me. I have not used this site in the month, but as soon as I came back to it today the same thing continues to be

    It's not just you.  I have this problem regularly, too.  I'm not sure that it is every 2 minutes, however.

  • What is the correct way to ask for help with the forum, rather than product, questions?

    I can't find the right way to ask a question about the forums themselves.

    PAGulley said

    I can't find the right part of the forum to ask questions about the forum itself and its features. I wonder what the right place and the way is to get help with the forum system itself. I can find the place to ask questions about specific Mozilla products very well.

    Look up where it says contributor tools and select Contributor Forums. Make sure that you scroll to the top or you'll get a bar with different links instead,

    The forum is https://support.mozilla.org/forums where you question would be better in the SUMO community discussions.

  • What is the best way to get several updates fail to install

    I have 32 updates that have failed to install.  How is the best way to go back and get to install them?

    You receive errors related to updates?

    1. Open Windows Update by clicking the Start button, all programs and then click Windows Update.
    2. In the left pane, click view update history.
      http://Windows.Microsoft.com/en-us/Windows-Vista/see-which-Windows-updates-are-installed
    3. Find an update for Windows that has failed to install, and then double-click the update to view more information.
      Updates that have failed to install will display failed under status, next to the name of update.
    4. In the Windows Update dialog box, next to the details of the error, review the error code for the update has failed.
    5. Follow the links in the Windows Update dialog box under more information or help and Support to resolve the problem, then try to reinstall updates by using Windows Update in Control Panel or by mail with the error code and maybe someone may be able to help others.

    Windows update General troubleshooting

    Suggestions:

    How to reset the Windows Update settings?
    http://support.Microsoft.com/kb/971058

    Diagnose and automatically fix common problems with Windows Update
    http://support.Microsoft.com/mats/windows_update/

    Cannot install updates in Windows Vista, Windows 7, Windows Server 2008 and Windows Server 2008 R2
    http://support.Microsoft.com/kb/2509997

    Or try to install the updates in a clean boot state, and run Windows Update: http://support.microsoft.com/kb/929135

  • Battery: What is the best way to keep when not in service

    Hello

    Now you know if it's the thread appropriate to ask.

    I have a 4 GB T400 but I decided to keep it until windows 7 fate because only he is lagging as * & ^ % and using my Office XP instead

    I think that Windows 7 comes out in full on September 09, so I wonder what is the best option to keep my laptop without altering my battery... I just got the laptop 29 Jun

    GAL like sh! t... F * & ^ Vista!

    Thank you

    Have you read the page I linked to?

  • What is the "correct" way to uninstall Windows 7?

    Good evening community... what Microsoft (or anyone out there) consider means of correcting/official to uninstall Windows 7 from my desktop PC?

    In the past, go all the way back to Windows 3.1 - Windows 98 - Windows ME - Windows XP - Windows Vista - and leading up to Windows 7, which is considered the 'official' Windows 7 Uninstall method (in my case Windows 7 Home Premium Retail Full Version)... I uninstalled Windows 7 by a variety of different methods, including 1) formatting the hard drive 2) a simple wiping of hard disk by using one of the many available software disks 3) or format the hard drive using the Windows disk.

    There are probably other ways to uninstall Windows 7 that I mention mostly because I've never used but the 3 methods I mentioned in the previous paragraph.

    Thank you!!!

    Jimmy

    There is no uninstall procedure itself, someone at - it 3 procedures you have listed will do. Personally I use the number of option 3.

    To format drive:

    1. Insert the DVD of Windows 7
    2. restart your computer
    3. When asked if you want to boot from your DVD player, do it.
    4. Select your language, click Next.
    5. click on "repair your computer".
    6. Select the operating system you want to repair.

    7. click on the command line

    8. at the command prompt, type: FORMAT C: /.

    Press enter on your keyboard

    Type y for Yes

    Press enter

    Please wait while the drive is formatted.

    Type exit to close the command prompt, and then click farm to shut down the computer.

  • What is the best way to automate VM Ware?

    Hello

    There are two different options for automating VM ware

    1 VI Toolkit (Powershell scripts)

    2 SDK & API in a .net application.

    Can anyone describe best practices?

    R,

    Méhul

    OK, now I see what you mean.

    That's actually what you put in the \[GuiRunOnce\] section of the unattend.txt or sysprep.inf file.

    You can see MS documentation on what is possible here. See here and here for more information.

    When you deploy a guest of a model with a specification of customization, the mechanism will use the sysprep utility to prepare the new machine.

    Run once the option allows you to specify one or more commands that must be run on the target client.

  • What is the correct way to write a loop for these variable declarations

    I want to simplify my code to the following code:

    var printImage1:MovieClip = new PrintImage1();
    var printImage2:MovieClip = new PrintImage2();
    var printImage3:MovieClip = new PrintImage3();
    var printImage4:MovieClip = new PrintImage4();
    var printImage5:MovieClip = new PrintImage5();
    var printImage6:MovieClip = new PrintImage6();

    I tried everything I could think of, but it always gives me compilation errors.

    Any help would be great.

    Thank you

    The following will work for what you want, but you will find that it is easier to work with objects if you create them as members of the Group and target them through it.

    for (var i: uint = 1; i<7;>
    var ClassRef: Class = Class (getDefinitionByName ("PrintImage" + String (i)));
    This ["printImage" + String (i)] = new ClassRef();
    }

  • What is the correct way to "downgrade" from Vista to XP on Satellite Pro A120?

    I want to downgrade to XP. I have a Satellite Pro A120 PSAC1E. How should I proceed? TIA.

    Hello

    First of all see if all drivers are available for this machine.
    You can check this link:

    http://EU.computers.Toshiba-Europe.com/cgi-bin/ToshibaCSG/download_drivers_bios.jsp
    http://209.167.114.38/support/download/ln_byModel.asp

    Then download the drivers and burn them to a CD/DVD. Back up your data on a DVD or external HARD drive.
    After you have done all these things, just put the CD in your drive and install XP and then install all the drivers and you'll be lucky.

    Please ask, if you have any questions...

    Welcome them

  • What is the correct way to PAT outbound on a 5540 for VPN traffic?

    We lack 8.3 (2) in the ASA5540. Throughout our company, users connect to application of a business through the ASA/VPN partner. We have an address space of class b, and because users are spread in all directions, I have the entire space class b as the local object in the ACL that allows traffic through the VPN tunnel.

    The business partner is worried that our entire address space is available to access the VPN tunnel. So I thought, to help the aliviate concerns, PAT all our outbound connections to a single IP address.

    How this is done in 8.3 (2)?  ASDM to configure the 5540.  For example, our class b is 159.12.0.0 and the PAT would have IP address will be 199.30.36.6.

    You can try:

    purpose of group 159.12.0.0_VPN

    network-object 159.12.0.0 255.255.0.0

    purpose of group 199.30.36.6_VPN_PAT

    Home 199.30.36.6

    object group remote_location

    network-object

    NAT (interface, interface) dynamic source 159.12.0.0_VPN destination 199.30.36.6_VPN_PAT static remote_location remote_location

    I would only give it a shot... You would NATting twice he... (You should replace 'interface', 'interface' with the actual interface names. You probably already knew that.)

  • What is the best way for foglight consume a webservice

    I hope that this is has not been replied that a bazillion times and if it is please send me the link I'm open to that.  What is the best way for foglight consume a Web service and respond with an alarm if the response from the Web service is not what is expexted.

    for example, calls Foglight webservice to acme.com/areuup and he responds with correct status in json format process.  If it does agree return, then foglight must send alerts to correct individuals.

    Thank you

    Kaleb

    in the end, we have used a perl script to capture the webservice and treat it and tables configuration.  Here is what has been written and created an agent custom.

    I apologize to all those who find the bulky comments, but it's my edition of journal of the script. I removed the comments once the script has been published and used.

    ===

    #! / usr/bin/perl

    #############################################################

    # Author: Kaleb J. Albee

    # Depandancies: SOA webservice

    # Engineers: Marc and Manu

    # Date: 28/02/2013 perl: (v5.14.2) built for x86_64-linux-gnu-thread-multi

    # Operating system: Linux 3.2.0 - 29-generic eam-ops-test #46 - Ubuntu SMP Wed Jul 27 17:03:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

    #############################################################

    use strict;

    use warnings;

    use Try::Tiny;

    use SOAP::Lite;

    use SOAP::WSDL;

    Use Time::Local;

    My = @soaenvs ('BSE - dev', 'BSE test', 'BSE-scene', 'BSE');

    # parameters: $_ [0] receives a call of SOAP client object.

    #

    void toStr {return $_ [0] == 1?} 'up': 'down' ;}

    void getBusResults {}

    # $_ [0] will be the $client spent

    # create a different buses SOAP connection.

    my $result = $_ [0]-> (getMessagingEngineHealth)

    # arg0 is used to set the setting for what is expected on the soa web service.

    SOAP::Data-> name (arg0 => $_ [1]));

    # $_ [1] will be the bus happened in

    return (Lk ($result) "started" eq? 1: 0);

    #return $result;

    }

    # Start sampling.

    My $curTimeStamp = "";

    my $count = 0;

    Print "LdsEsbBusHealth5\nSTART_SAMPLE_PERIOD\n TABLE";

    foreach my {$soae (@soaenvs)

    my $client is SOAP::Lite-> service ("put the url of the webservice here.");.

    $count ++;

    # create an object to inspect objects. My $insp = Data new::Inspect->; Download the time stamp for this.

    my ($sec, $min, $hr, $day, $mon, $year) = localtime;

    # format the year correctly for useage.

    My $curyear = 1900 + $year;

    # the hand to the fglam agent fields at the tables.

    My $soacei = getBusResults ($client, "messaging.000 - CEI.esb.BUS");

    My $soaapp = getBusResults ($client, "messaging.000 - SCA.APPLICATION.esb.Bus");

    My $soasys = getBusResults ($client, "messaging.000 - SCA.SYSTEM.esb.Bus");

    $curTimeStamp = ' $curyear$ MON$ day$ hr$ min$ s ";

    Print "SoaEnv.String.id=$soae\n";

    Print "CeiBusNum = $soacei\n";

    Print "AppBusNum = $soaapp\n";

    Print "SysBusNum = $soasys\n";

    Print "CeiBusStr.StringObservation.obs =". toStr ($soacei). "\n";

    Print "AppBusStr.StringObservation.obs =". toStr ($soaapp). "\n";

    Print "SysBusStr.StringObservation.obs =". toStr ($soasys). "\n";

    Print "Daterun.StringObservation.obs=$curTimeStamp\n";

    If ($count<=>

    Print ("NEXT_SAMPLE\n");

    }

    } {$soae foreach (@soaenvs) #.

    Print "END_TABLE\n";

    Exit 0;

    ===

    I hope this helps someone out there!

    Bravo!

  • What is the correct notation for complex variables

    I need to handle files after download. They are all uploaded in 1 directory by a flash component and then I need to rename them, and move to the directory that corresponds to the choice of categories and subcategories. Now I'm having trouble finding how to get my variables correctly

    It's the thisFiletoMove1 variable, it must match the destination file in the cffile tag

    (< FileExists('#request.site.imgupload#\max_#MultiPowUploadFileName_0#') cfif >
    < cffile action = "Rename".
    source="#request.site.imgupload#\max_#MultiPowUploadFileName_0#".
    destination="#request.site.imgupload#\#request.currentimgid#_max.jpg" >
    < cfset thisFiletoMove1 = #request.currentimgid #_max.jpg / >
    < / cfif >

    < cfset thisFiletoMove1 = #request.currentimgid #_max.jpg / > is what gives an error construct CFML invalid encountered, ColdFusion was looking at the following:

    _max.jpg

    Then I try

    < cfset thisFiletoMove1 = #request.currentimgid & "_max.jpg" / > and I get

    The C:\websites\beta.antiek.net\demo\galleries\test\thisFiletoMove1 source specified in the cffile tag is not valid

    So now I wonder, what is the correct way to do this?

    Bianca

    bianca_homedev wrote:

    I need to handle files after download. They are all uploaded in 1 directory by a flash component and then I need to rename them, and move to the directory that corresponds to the choice of categories and subcategories. Now I'm having trouble finding how to get my variables correctly

    It's the thisFiletoMove1 variable, it must match the destination file in the cffile tag


     
    source="#request.site.imgupload#\max_#MultiPowUploadFileName_0#".
    destination="#request.site.imgupload#\#request.currentimgid#_max.jpg" >
       

    is what gives a construction of CFML not valid error found, ColdFusion was looking at the following:

    _max.jpg

    Then I try

    and I get

    The C:\websites\beta.antiek.net\demo\galleries\test\thisFiletoMove1 source specified in the cffile tag is not valid

    So now I wonder, what is the correct way to do this?

    All are both wrong:


    You were near. What you meant was probably

    However, are even better

  • What is the correct syntax for the use of a variable in an ad-hoc query?

    Hi all

    I'm a casual user of the DB and right now need to update the records about 1000 + so that a certain column gets a unique value.

    So I thought I'd use a variable for this.

    Then, I built this type of SQL statement for only a small subset of records:
    ----------
    variable number recNumber;
    exec: recNumber: = 1;
    UPDATE TABLE_TO_BE_UPD
    SET COL_TO_BE_UPD = COL_TO_BE_UPD + recNumber
    WHERE COL_TO_BE_UPD IN ('VAL_A', 'VAL_B');
    ----------

    I get invalid SQL statement error when you try to run above (except for the guest who asks for a value I want to omit).

    In any case, I also tried this one:
    ----------
    CREATE SEQUENCE seqCounter;
    UPDATE TABLE_TO_BE_UPD
    SET COL_TO_BE_UPD = COL_TO_BE_UPD + seqCounter.NEXTVAL
    WHERE COL_TO_BE_UPD IN ('VAL_A', 'VAL_B');
    ----------

    Of it, I got the error ORA-01722: invalid number... I guess it's because seqCounter is of type number and the COL_TO_BE_UPD is of type character... (?)

    Then I want to ask is what is the correct way to define and use a counter variable type to add a number at the end of a string?

    Also another question I would ask is that are variables that are used in queries ad hoc, also called "bind variables"?

    Thank you muchly

    If you want to add a unique number to a column, then it would be:

    UPDATE TABLE_TO_BE_UPD
    SET COL_TO_BE_UPD = COL_TO_BE_UPD ||to_char(rownum)
    WHERE COL_TO_BE_UPD IN ('VAL_A','VAL_B');
    

Maybe you are looking for