Scalar Variable Syntax questions

I am practicing Scalar  Variables in a workbook.  Can some help me answer these questions working with Variables.   The Table name is Flights.
Create and set a Variable equal to the number of Flights that were late.
Multiply that amount by the amount lost per late flight ($1,029) and store the amount in another variable.
Take the total amount lost (#4) and subtract it from Total profit ($45,000) and store that number in a variable.
Find out the Earliest FlightDate and add 10 years to it and store it in a variable.
Find out the day of the week for the Latest FlightDate and store it in a variable.

I'm not really sure how you would benefit from we giving the answers to your exercises. How would you learn from that?
I will only point what I think is a misunderstanding. When they say Create and set a Variable equal to the number of Flights that were late., I think they mean a scalar variable, not a table variable.
Erland Sommarskog, SQL Server MVP, [email protected]

Similar Messages

  • Fixing this Scalar Variable Syntax question

    Please help me to correct this syntax for this practice question below.
    /* Create and set a Variable equal the number of Flights that were late.*/
    DECLARE @FlightsLate varchar(50)
    SET @FlightsLate = (SELECT* FROM
    Flights WHERE Ontime = 0)
    SELECT @FlightsLate

    If you want to get the total numbers that are late you need to do this
    DECLARE
    @FlightsLate varchar(50)
    SET
    @FlightsLate = (SELECT count(*) FROM
    Flights WHERE
    Ontime = 0)
    SELECT
    @FlightsLate
    Assuming that Ontime =0 means Late
    Javier Villegas |
    @javier_vill | http://sql-javier-villegas.blogspot.com/
    Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you

  • How to convert a scalar variable into a 1-D length N array?

    Hi guys,
    I am new in Labview. I use Labview to accquire the output data from a measurement circuit with RS232 bus. The result needs some mathematical operation to have a meaningful number. After this operation the result is a scalar variable that is changing as new data read from my circuit. I want to see the power spectrum of this signal so tried to use FFT block (Labview 6.1, signal processing->frequency domain->real fft / power spectrum). However because the fft block needs 1-D array type of data as input, I can not just connect my result to the fft block. The error it gives me is:
    These cannot be wired together because their data types (numeric,
    string, array, cluster, etc.) do not match. Show the Context Help
    window to see what data type is required.
    The type of the source is double [64-bit real (~15 digit precision)].
    The type of the sink is 1-D array of double [64-bit real (~15 digit precision)].
    So I guess I have to do something to convert my result into a 1-D array with a length N, which is the number of data I use for one FFT transform. But the question is how.
    I pass the data directly through a For-loop, the result is a 1-D array with all the members having the same value as the input value(my calculated result). Then next time a new result come in, all of the members of that array changes to the new value.
    Please help!

    Hi nano,
    "So I interpret that as putting the for loop (the subVI) in another for loop?" - Yes, correct.
    See example! (Also on better using LV primitives.)
    Where is this "vsource control block"?
    Message Edited by GerdW on 03-02-2009 11:24 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    example.vi ‏20 KB

  • Getting "Must declare the scalar variable" Error

    Hello All,
    I have write following query to block invoice which has Prices not equal to PriceList as below.
    -- To Block Invoices which has Prices not equal to PriceList
    IF (@transaction_type='A' OR @transaction_type = 'U') AND CAST(@OBJECT_TYPE = '18')
    BEGIN
        SELECT T1.ItemCode,
                T1.Price AS PO_Price,
                T2.U_ListPrice AS Listed_Price
            FROM OPCH AS T0 
            INNER JOIN
            PCH1 AS T1 ON
            T0.DocEntry = T1.DocEntry
            LEFT OUTER JOIN    
            [dbo].[@PRICELISTS] AS T2 ON
            T1.ItemCode = T2.U_ItemNo
        WHERE
                    T1.DocEntry = @list_of_cols_val_tab_del) AND
            (T1.Price <> T2.U_ListPrice)   
    BEGIN
    SET @error = 123
    SET @error_message = 'Deviation in price'
    END
    END
    But after Execution got following Errors
    Msg 137, Level 15, State 2, Line 2
    Must declare the scalar variable "@transaction_type".
    Msg 137, Level 15, State 2, Line 19
    Must declare the scalar variable "@list_of_cols_val_tab_del".
    Msg 137, Level 15, State 1, Line 22
    Must declare the scalar variable "@error".
    Msg 137, Level 15, State 1, Line 23
    Must declare the scalar variable "@error_message".
    Please Help
    Regards
    Hitul

    Hi Hitul,
    Please check Snapshot.
    Please see Red Lines for SBO_SP_TransactionNotification Procedure.
    Paste your code below ADD YOUR CODE HERE.
    Hope this help
    Regards::::
    Atul Chakraborty

  • Must declare the Scalar variable *@prompt*.. (IES 10901)".

    Hi,
    I am getting an error: "Database error Must declare the Scalar variable *@prompt*.. (IES 10901)".
    backend: SQLServer
    The dim, Lovs are valid in IDT universe.
    There is a Fiscal Year Month Dim in Universe=SELECT
      cast(convert(varchar(6),DATEADD (YEAR,"COST_SUMMARY_FACT_VR"."FISC_YEAR"-1900,DATEADD(MONTH,"COST_SUMMARY_FACT_VR"."FISC_PERIOD"-1,DATEADD(DAY,0,0 ))),112) as int)
    FROM "COST_SUMMARY_FACT_VR"
    Lov
    There are two LOVs FP_From, FP_To
    1) FP_From= select distinct cast(convert(varchar(6),DATEADD (YEAR,"COST_SUMMARY_FACT_VR"."FISC_YEAR"-1900,DATEADD(MONTH,"COST_SUMMARY_FACT_VR"."FISC_PERIOD"-1,DATEADD(DAY,0,0 ))),112) as int) from COST_SUMMARY_FACT_VR order by 1
    2) FP_To=select distinct cast(convert(varchar(6),DATEADD (YEAR,"COST_SUMMARY_FACT_VR"."FISC_YEAR"-1900,DATEADD(MONTH,"COST_SUMMARY_FACT_VR"."FISC_PERIOD"-1,DATEADD(DAY,0,0 ))),112) as int) from COST_SUMMARY_FACT_VR order by 1
    Prompts
    There are two universe prompts
    1) FP_From is Numeric and LOV FP_From is attached
    2) FP_To is Numeric and LOV FP_To is attached
    Using the universe prompts in webi as
    Fiscal Year Month between FP_From and FP_To
    Qry is executing perfectly in backend.

    In addition to Visakh's solution: the reason you got the error message is because the piece of dynamic SQL is not part of the stored procedure, but constiutes a scope of its own. Thus variables declared in the surrounding procedure are not visible.
    Also, you should the dynamic SQL this way:
    SET @sql = N'
    SELECT @Result=COUNT( Id ) FROM  ' + quotename(@TableName) +
    ' WHERE RunRegisterKey=@ID'
    SET @Params = N'@Result int OUTPUT, @ID int'
    EXEC sys.sp_executesql @sql,@Params,@Result = @Result OUT, @ID = @ID
    That is, use quotename for the table name, in case you have a table named
    sys.objects; SHUTDOWN WITH NOWAIT; --
    Furthermore, pass @ID as a parameter rather than concatenating it to the string. It is both easier and safer.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Must declare the scalar variable

    I Am getting error as Must declare the scalar variable "@Imageid" for the following code,while executing,
    exec spGetPager  ' ' , ' ', ' 3 ', ' '
    In my coding I pass querystring value like 1,2,3 etc
    CREATE PROCEDURE spGetPager
          @PageNo int = 1,  
          @ItemsPerPage int = 1,  
     @Imageid int,
          @TotalRows int out  
    AS  
    BEGIN  
      SET NOCOUNT ON  
      DECLARE  
        @StartIdx int,  
        @SQL nvarchar(max),   
        @SQL_Conditions nvarchar(max),   
        @EndIdx int
          IF @PageNo < 1 SET @PageNo = 1  
          IF @ItemsPerPage < 1 SET @ItemsPerPage = 10  
          SET @StartIdx = (@PageNo -1) * @ItemsPerPage + 1  
          SET @EndIdx = (@StartIdx + @ItemsPerPage) - 1  
          SET @SQL = 'SELECT Imageid,Imagepath,imagename,username  
                    FROM (  
                    SELECT  ROW_NUMBER() OVER(ORDER BY Imageid) AS Row, *  
                          FROM  Imageupload ) AS tbl WHERE Imageid=@Imageid AND Row >= '  
                                        + CONVERT(varchar(9), @StartIdx) + ' AND  
                           Row <=  ' + CONVERT(varchar(9), @EndIdx)  
          EXEC sp_executesql @SQL  
          SET @SQL = 'SELECT @TotalRows=COUNT(*) FROM Imageupload'  
          EXEC sp_executesql  
            @query = @SQL,  
            @params = N'@TotalRows INT OUTPUT',  
            @TotalRows = @TotalRows OUTPUT  
    END
    Thanks in Advance

    you cant use variable directly in concatenation operator as its of type int. you need to cast it first as below
    CREATE PROCEDURE spGetPager
    @PageNo int = 1,
    @ItemsPerPage int = 1,
    @Imageid int,
    @TotalRows int out
    AS
    BEGIN
    SET NOCOUNT ON
    DECLARE
    @StartIdx int,
    @SQL nvarchar(max),
    @SQL_Conditions nvarchar(max),
    @EndIdx int
    IF @PageNo < 1 SET @PageNo = 1
    IF @ItemsPerPage < 1 SET @ItemsPerPage = 10
    SET @StartIdx = (@PageNo -1) * @ItemsPerPage + 1
    SET @EndIdx = (@StartIdx + @ItemsPerPage) - 1
    SET @SQL = 'SELECT Imageid,Imagepath,imagename,username
    FROM (
    SELECT ROW_NUMBER() OVER(ORDER BY Imageid) AS Row, *
    FROM Imageupload ) AS tbl WHERE Imageid=' + CAST(@Imageid AS varchar(50)) + ' AND Row >= '
    + CONVERT(varchar(9), @StartIdx) + ' AND
    Row <= ' + CONVERT(varchar(9), @EndIdx)
    EXEC sp_executesql @SQL
    SET @SQL = 'SELECT @TotalRows=COUNT(*) FROM Imageupload'
    EXEC sp_executesql
    @query = @SQL,
    @params = N'@TotalRows INT OUTPUT',
    @TotalRows = @TotalRows OUTPUT
    END
    That being I didnt understand why you need dynamic sql here. There's no dynamicity involved as i see
     you could simply use a sql like below
    CREATE PROCEDURE spGetPager
    @PageNo int = 1,
    @ItemsPerPage int = 1,
    @Imageid int,
    @TotalRows int out
    AS
    BEGIN
    SET NOCOUNT ON
    DECLARE
    @StartIdx int,
    @EndIdx int
    IF @PageNo < 1 SET @PageNo = 1
    IF @ItemsPerPage < 1 SET @ItemsPerPage = 10
    SET @StartIdx = (@PageNo -1) * @ItemsPerPage + 1
    SET @EndIdx = (@StartIdx + @ItemsPerPage) - 1
    SELECT Imageid,Imagepath,imagename,username
    FROM (
    SELECT ROW_NUMBER() OVER(ORDER BY Imageid) AS Row, *
    FROM Imageupload ) AS tbl WHERE Imageid=@Imageid
    AND Row >= @StartIdx
    AND Row <= @EndIdx
    SELECT @TotalRows=COUNT(*) FROM Imageupload
    END
    to achieve same requirement.
    Make sure you read
    http://www.sommarskog.se/dynamic_sql.html
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Must declare the scalar variable error

    I am getting the error "Must declare the scalar variable "@Result""  when i execute the below query
    declare @sql nvarchar(max),
    @tablename varchar(200),
    @Id int,
    @Result int
    set @tablename='xyz'
    set @id=1
    SET @sql = '
    SELECT @Result=COUNT( Id ) FROM  ' + @TableName+ ' WHERE RunRegisterKey=' +convert(nvarchar(100),@ID)  
    EXEC sys.sp_executesql @sql

    In addition to Visakh's solution: the reason you got the error message is because the piece of dynamic SQL is not part of the stored procedure, but constiutes a scope of its own. Thus variables declared in the surrounding procedure are not visible.
    Also, you should the dynamic SQL this way:
    SET @sql = N'
    SELECT @Result=COUNT( Id ) FROM  ' + quotename(@TableName) +
    ' WHERE RunRegisterKey=@ID'
    SET @Params = N'@Result int OUTPUT, @ID int'
    EXEC sys.sp_executesql @sql,@Params,@Result = @Result OUT, @ID = @ID
    That is, use quotename for the table name, in case you have a table named
    sys.objects; SHUTDOWN WITH NOWAIT; --
    Furthermore, pass @ID as a parameter rather than concatenating it to the string. It is both easier and safer.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Simple Task - Syntax Question (how do you pass variables from one component to another component - databinding)?

    Hi all,
    I'm trying to pass some width/height/URLs from a Video Player component to a Social Bookmarking component's embed text input field. (for people to grab and share videos).
    I know this is a simple task, but it's the end of the day and I seem to be having a brain failure... What's the syntax to achieve this? Do I have to import the video player component? These widths/heights/URLs are all being dynamically generated from an XML... should I be pulling it from the XML or just reuse the variables that already exist in the Video Player component?
    Here's my code...
    Video Player:
    [Bindable]
    public var source:String = "";
    [Bindable]
    public var autoPlay:Boolean = false;
    [Bindable]
    public var fullScreenMode:Boolean = false;
    [Bindable]
    public var clipTag:String = "_movie";
    [Bindable]
    public var iag_code:String = "";
    [Bindable]
    public var officialURL:String = "http://www.movies.com/";
    [Bindable]
    public var referer:String = "unknown";
    [Bindable]
    public var gID:String;
    [Bindable]
    public var starterImageURL:String = 'http://www.movies.com/jazzmaster/images/default_starter_image.
    [Bindable]
    public var oldWidth:Number;
    [Bindable]
    public var oldHeight:Number;
    Sharing Component:
    <mx:HBox
      height="10%"
      horizontalCenter="-25"
      verticalCenter="0"
      paddingBottom="5">
      <mx:Text text="Embed Code:" paddingTop="1" color="#FFFFFF" fontSize="12"/>
      <mx:TextInput  text="{oldWidth}"/>
    </mx:HBox>
    The code above throws an error... "Attempted access of inaccessible property oldWidth through a reference with a static type com:SharingBookmarks."
    Thanks all!
    DK

    Try this..
    create a new flex project and add a folder called "src"
    create a new MXML component named "VideoComp.mxml" and copy/paste
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
    <mx:Script>
    <![CDATA[
    [Bindable]
    public var videoWidth:int = 300;
    [Bindable]
    public var videoHeight:int = 300;
    ]]>
    </mx:Script>
    <mx:Label text="Vidoe" />
    <mx:TextInput text="{videoWidth}" id="w" change="this.videoWidth = int(w.text);" />
    <mx:TextInput text="{videoHeight}" id="h" change="this.videoHeight = int(h.text);" />
    </mx:VBox>
    create a new MXML component named, "SharingComp.mxml" add copy/paste this..
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
    <mx:Script>
    <![CDATA[
    [Bindable]
    public var videoWidth:int;
    [Bindable]
    public var videoHeight:int;
    ]]>
    </mx:Script>
    <mx:Label text="Sharing Comp." />
    <mx:Label text="{videoWidth}" />
    <mx:Label text="{videoHeight}" />
    </mx:VBox>
    and here is the main.mxml file
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:src="src.*">
        <mx:Script>
            <![CDATA[
                private function doSomething():void
                 sharingComp.videoHeight = videoComp.videoHeight;
                 sharingComp.videoWidth = videoComp.videoWidth;
            ]]>
        </mx:Script>
       <src:VideoComp id="videoComp" />
       <mx:Button click="doSomething()" label="copy" />
       <src:SharingComp id="sharingComp" />
    </mx:Application>
    Hope this helps,
    BaBo,

  • Question with variable syntax

    Ok
    I run this;
    select name
    from shuttle_demo_category where id = 30;
    It returns this:
    name
    ITEM 10
    I am making this stored procedure:
    create or replace
    PROCEDURE loadname AS
    BEGIN
    declare
    f utl_file.file_type;
    V_dir varchar2(10);
    cursor c_item is
    select name
    from shuttle_demo_category where id = 30;
    r_item c_item%ROWTYPE;
    begin
    ----grant execute on utl_file to public; This must be done first
    ---USER_DIR is the oracle dir
    --- in this case USER_DIR is really c:\temp
    V_dir := 'USER_DIR';
    f := utl_file.fopen(V_dir, 'thing2.xml', 'w');
    utl_file.put_line(f, '<?xml version="1.0" ' ||r_item.name || 'encoding="utf-8"?>');
    utl_file.put_line(f, '<outline xmlns="http://xmlns.oracle.com/oxp/book/">');
    utl_file.put_line(f, '<!--');
    utl_file.put_line(f, 'The title-page element should point to a PDF title page inserted');
    utl_file.put_line(f, 'at the beginning of the book. (OPTIONAL)');
    utl_file.put_line(f, '<!-- So here is the title page reference, in this case it is going to use an RTF template -->');
    utl_file.put_line(f, '<title-page type="rtf">c:/temp/Tableofcontents.rtf</title-page>');
    utl_file.put_line(f, ' <!-- next follow all documents we want to combine -->');
    utl_file.put_line(f, '<item>');
    utl_file.put_line(f, ' <content-container>');
    utl_file.put_line(f, ' <content>c:\temp\mypage1.pdf</content>');
    utl_file.put_line(f, ' </content-container>');
    utl_file.put_line(f, ' </item>');
    utl_file.put_line(f, '<item>');
    utl_file.put_line(f, ' <content-container>');
    utl_file.put_line(f, ' <content>c:\temp\mypage2.pdf</content>');
    utl_file.put_line(f, ' </content-container>');
    utl_file.put_line(f, ' </item>');
    utl_file.put_line(f, '<item>');
    utl_file.put_line(f, ' <content-container>');
    utl_file.put_line(f, ' <content>c:\temp\mypage3.pdf</content>');
    utl_file.put_line(f, ' </content-container>');
    utl_file.put_line(f, '</item>');
    utl_file.put_line(f, '</outline>');
    utl_file.fclose(f);
    end;
    END loadname;
    It returns this in the file:
    <?xml version="1.0" encoding="utf-8"?>
    <outline xmlns="http://xmlns.oracle.com/oxp/book/">
    <!--
    The title-page element should point to a PDF title page inserted
    at the beginning of the book. (OPTIONAL)
    <!-- So here is the title page reference, in this case it is going to use an RTF template -->
    <title-page type="rtf">c:/temp/Tableofcontents.rtf</title-page>
    <!-- next follow all documents we want to combine -->
    <item>
    <content-container>
    <content>c:\temp\mypage1.pdf</content>
    </content-container>
    </item>
    <item>
    <content-container>
    <content>c:\temp\mypage2.pdf</content>
    </content-container>
    </item>
    <item>
    <content-container>
    <content>c:\temp\mypage3.pdf</content>
    </content-container>
    </item>
    </outline>
    It did not insert the variable.... why???
    Thanks for your help,
    Doug

    I tryed this:
    create or replace
    PROCEDURE loadname AS
    BEGIN
    declare
    f utl_file.file_type;
    V_dir varchar2(10);
    cursor c_item is
    select name
    from shuttle_demo_category where id = 30;
    r_item c_item%ROWTYPE;
    begin
    ----grant execute on utl_file to public; This must be done first
    ---USER_DIR is the oracle dir
    --- in this case USER_DIR is really c:\temp
    fetch c_item into r_item;
    V_dir := 'USER_DIR';
    f := utl_file.fopen(V_dir, 'thing2.xml', 'w');
    utl_file.put_line(f, '<?xml version="1.0" ' ||r_item.name || 'encoding="utf-8"?>');
    utl_file.put_line(f, '<outline xmlns="http://xmlns.oracle.com/oxp/book/">');
    utl_file.put_line(f, '<!--');
    utl_file.put_line(f, 'The title-page element should point to a PDF title page inserted');
    utl_file.put_line(f, 'at the beginning of the book. (OPTIONAL)');
    utl_file.put_line(f, '<!-- So here is the title page reference, in this case it is going to use an RTF template -->');
    utl_file.put_line(f, '<title-page type="rtf">c:/temp/Tableofcontents.rtf</title-page>');
    utl_file.put_line(f, ' <!-- next follow all documents we want to combine -->');
    utl_file.put_line(f, '<item>');
    utl_file.put_line(f, ' <content-container>');
    utl_file.put_line(f, ' <content>c:\temp\mypage1.pdf</content>');
    utl_file.put_line(f, ' </content-container>');
    utl_file.put_line(f, ' </item>');
    utl_file.put_line(f, '<item>');
    utl_file.put_line(f, ' <content-container>');
    utl_file.put_line(f, ' <content>c:\temp\mypage2.pdf</content>');
    utl_file.put_line(f, ' </content-container>');
    utl_file.put_line(f, ' </item>');
    utl_file.put_line(f, '<item>');
    utl_file.put_line(f, ' <content-container>');
    utl_file.put_line(f, ' <content>c:\temp\mypage3.pdf</content>');
    utl_file.put_line(f, ' </content-container>');
    utl_file.put_line(f, '</item>');
    utl_file.put_line(f, '</outline>');
    utl_file.fclose(f);
    close r_item;
    end;
    END loadname;
    but got:
    Connecting to the database caprs.
    ORA-01001: invalid cursor
    ORA-06512: at "CAPRS.LOADNAME", line 18
    ORA-06512: at line 2
    Process exited.
    Disconnecting from the database caprs.

  • Reference Variable syntax??

    I have a large table that I want to filter on any field. I have the dataProvider array and the fieldname in a variable.  Can anyone point me in the right direction on how to set up a dynamic filter, all I can find are static item.arrayLabel in a filterFunction  where item is the dataProvider and arrayLabel is the "column" (item.city or item.state versus item[fieldName] where fieldname can be "data" or "label").  My ultimate goal is to eliminate [object Object] from the list if there are any NULL items in the database for that fieldname.  All help is appreciated.

    Thanks Gordon,  it seems my syntax was correct but my logic failing.  My filterFunction was (item[fieldName]!="" || item[fieldName]!=null) instead of &&  I had no confidence in the syntax. Hate it when I doubt myself
    Thanks again. This is going to be a pretty slick SQL generator for reporting once complete. Here we are selecting the WHERE criteria for the fields included in the report.  My previous question (unanswered) instead of rendering ComboBox for each row, only fields with lookup tables would have had a ComboBox and these other potentially null fields were going to render TextInputs - but never could get that working with dynamic dataProviders.  This may be a better solution, just need to make the non-lookup ComboBoxes editable.
    Thanks again.

  • Please help with an ICM script editor syntax question.

    I need to modify a set variable node.  What I have now is Call.PeripheralVariable8+".wav" and this works.  What I need it to say is Call.PeripheralVariable8+anything+".wav" but when I insert an * for the anything it's seen as a multiplier.  What's the syntax to do this?  The anything I need to add is _9xxx where xxx are other numbers, but the _9 will be in all, if that helps any.  Thanks in advance !!

    You can use the concatenate() function to build up your string, as you no doubt know.
    As far as the wildcard goes ... your intention must be to try to SET the call variable and later on test the call variable with an IF node. Is that right?
    You would be able to test parts of the string using the substr() function - which is based on character position. If that is a fixed value that you know, it's easy. If it's not, you can first use the find() function to locate something (like the "_9"), returning the position, and then use the substr() function to pull it off.
    Can you write some pseudo-code here to define exactly your intention? You can set up a dummy script and send a dummy call through using Call Tracer and watch the output to see how your code is working.
    Regards,
    Geoff

  • Select SQL statement with variable syntax error

    Hi All,
    I am running a Web Application with a java bean to connect to a mysql database. i have compiled a test .java file whcih works using the same statement that has a problem in my web application. Taking the statement out of the Web App makes it work so it must be this stetment:
    String SQLStatement = "SELECT * FROM MASTER WHERE USERNAME LIKE '"+data+"' ";
    This works fine in testing a separate java file, but it does not compile when running ant build to compile the same line of code for my Web App.
    I have tried many possibilities of changing the syntax to no avail, its a puzzle!
    Many thanks for any swift reply.
    ChrisG

    prepare:
    copy:
    build:
    [javac] Compiling 1 source file to C:\jwsdp-1.3\garland\build\WEB-INF\classe
    s
    [javac] C:\jwsdp-1.3\garland\src\LogonBean.java:20: cannot resolve symbol
    [javac] symbol : variable data
    [javac] location: class logonApp.LogonBean
    [javac] String SQLState2 = "SELECT PASSWORD FROM MASTER WHERE PASSWORD L
    IKE '"+data+"' ";
    [javac]
    ^
    [javac] C:\jwsdp-1.3\garland\src\LogonBean.java:79: cannot resolve symbol
    [javac] symbol : variable SQLState1
    [javac] location: class logonApp.LogonBean
    [javac] rs = stmt.executeQuery(SQLState1);
    [javac] ^
    [javac] 2 errors
    Thats the compiler error, but it still works on a normal java file. ill try a prepared statement in the mean time.
    ChrisG

  • A syntaxic question...

    Hi guys,
    I've posted about this on this very forum before, but I can't find my own question... and the answers that you people provided, so I'll do it again: what's wrong with the following, knowing that I have Developer Tools installed and that I clearly remember writing a script along those lines a long time ago, when I was still using Tiger?
    Here goes:
    "move mouse
    720, 450 {from left, from top}"
    Where the goal is to move the mouse pointer center screen on startup (don't bother about compiling and saving as an app, just about the right syntax). Something's missing, but I can't put my finger on it...

    The app developer once told me that the delay in activating the mouse was built-in, because it took the Trackpad some time (usually no more than a second or two) to fully activate. So I guess I can't get anything better than what I already have: at least I don't accidentally trigger the Apple menu by trying to move my mouse pointer to screen center...
    Well, trying to stress my brain to figure out an impossible solution.
    FWIW, here's the code, before modification:
    move mouse {720, 450} -- {from left, from top}
    click mouse
    delay 0.1
    click mouse
    delay 0.1
    move mouse {730, 460} -- {from left, from top}
    I'm going to add a two-second delay between the two mouse clicks, just in case. I'll keep you posted. As for the compliment, it's amply deserved, and I'm not the only one on this forum who says so...
    I you are trying to simulate a double click, you need to make the delay closer to what a human would do. Two seconds will most likely turn the double click into two single click.
    2
    All this is probably not need since you fessed up to it being a driver problem.
    Cheers!
    Thanks again for your rewarding comments.

  • Cursor bind variable syntax err

    Any one help me in correcting the syntax, for cursor return.
    Oracle version 10g
    I am trying to execute the sproc and print the cursor results using bind variable, I am getting he below error
    Variable V_REFCUR REFCURSOR
    Variable V_REFCUR2 REFCURSOR
    variable swp_ret_value NUMBER
    exec  DELETE_POSITION(0,0,2,'U',:swp_ret_value,:V_REFCUR,:V_REFCUR2)
      print swp_ret_value
      Print v_refcur
      Print v_refcur2
    -- output
    Error starting at line 5 in command:
    exec  DELETE_POSITION(0,0,2,'U',:swp_ret_value,:V_REFCUR,:V_REFCUR2)
    Error report:
    Cursor is closed.
    SWP_RET_VALUE
    V_REFCUR
    V_REFCUR2
    ------Edited by: NeilCSE on Jan 18, 2011 4:08 AM

    it is calling another proc
    PROCEDURE Assign_outRefcur2 (CurrentCursor IN OUT SYS_REFCURSOR
                                                          , v_ref_cur IN OUT SYS_REFCURSOR
                                                          , v_ref_cur2 IN OUT SYS_REFCURSOR
    AS
       InitCursor SYS_REFCURSOR;
    BEGIN
    IF NOT v_ref_cur%IsOpen THEN v_ref_cur := CurrentCursor;
       ELSIF NOT v_ref_cur2%IsOpen THEN v_ref_cur2 := CurrentCursor;
    END IF;
    CurrentCursor:= InitCursor;
    END;

  • 11g pivot query syntax question

    I searched the forums and I have seen questions similiar to the one I am asking, but its not the exact same issue.
    I need 3 fields in my 'for' clause. I get 'column ambiguously defined. I think I get this error for a different reason that other people asking the question.
    The others seem to be doing more than 1 function in the pivot clause and those need an alias. I give an alias with my 1 function and still get an error.
    ORA-00918: column ambiguously defined
    I used aliases like the recommendation in other posts and I still get the same error. I think I need 3 columns in the for clause.
    --note that this is just a test table. These are not real names going into production
    create table pivot_tab (
    pk1 number,
    pk2 number,
    myElement varchar2(30),
    myElementDate date);
    pk1,pk2 are the unique key.
    I need this to return as: the vlaues after pk2, can be any alias. This is just an example.
    pk1  pk2  MY1_DATE, MY2_DATE, MY3_DATE
    select *
         from pivot_tab
        PIVOT ( max(myElementDate) for myElement
                in (''MY1','MY2','MY3'))
    I saw a couple of references to this syntax, but I get syntax errors.
    ora--00906: missing parentheses. So I dont think this syntax works.
    select *
         from pivot_tab
        PIVOT ( max(myElementDate) for (pk1,pk2,myElement)
                in (''MY1','MY2','MY3'))Edited by: Guess2 on May 6, 2013 6:50 AM

    don't have any sample data or expected results to test this with maybe
    SELECT *
      FROM (SELECT pk1,
                   pk2,
                   myelement,
                   myelementdate
              FROM pivot_tab) PIVOT (MAX (myElementDate)
                              FOR myElement
                              IN ('MY1' AS MY1, 'MY2' AS MY2, 'MY3' AS MY3));or maybe you are trying to pivot by the first part of the pk?
    with pivot_tab as (select 1 pk1, 2 pk2, 'MY1' myelement, sysdate myelementdate from dual union all
                       select  1 pk1, 3 pk2, 'MY2' myelement, add_months(sysdate,2) myelementdate from dual union all
                       select  1 pk1, 4 pk2, 'MY3' myelement, add_months(sysdate,3) myelementdate from dual union all
                       select 2 pk1, 5 pk2, 'MY1' myelement, sysdate myelementdate from dual union all
                       select  2 pk1, 6 pk2, 'MY2' myelement, add_months(sysdate,6) myelementdate from dual union all
                       select  2 pk1, 7 pk2, 'MY3' myelement, add_months(sysdate,7) myelementdate from dual )
    SELECT *
      FROM (SELECT pk1,
                   myelement,
                   myelementdate
              FROM pivot_tab) PIVOT (MAX (myElementDate)
                              FOR myElement
                              IN ('MY1' AS MY1, 'MY2' AS MY2, 'MY3' AS MY3));
    PK1     MY1     MY2     MY3
    1     5/6/2013 10:07:40 AM     7/6/2013 10:07:40 AM     8/6/2013 10:07:40 AM
    2     5/6/2013 10:07:40 AM     11/6/2013 10:07:40 AM     12/6/2013 10:07:40 AMEdited by: pollywog on May 6, 2013 10:08 AM

Maybe you are looking for

  • Auto Logout

    Hi Expert! I have been set the rdisp/gui_auto_logout for the 20 minutes to kill the idle sessions, rdisp/keepalive already set to 20 minutes. My users are complaining that when they are doing the foreground / background processing, users sessions are

  • How do I prevent Save as .csv file alwways appending .txt to the filename if I choose the "Open with" action?

    My ASP csv download page is calling: Response.Clear Response.AddHeader "content-disposition","attachment; filename=filename.csv" Response.ContentType = "Content-Type: text/csv; charset=utf-8" When I click on the link to this ASP page the Firefox "Ope

  • Where have all the old appointments gone from my calendar?

    Now that I have signed up for iCloud, I can't find the old appointments in my calendar.  I need those for billings.  Anybody know where I can find them?

  • Scrolling down automatically

    Hi I noticed some strange behaviour of a JTextArea in a JScrollPane (I always use this like that, perhaps there might be better ways - I appreciate any suggestions on that, too). When I init the text area with "" the display always scrolls down to th

  • 2GB SD Cards

    My Palm Tx was reading from the 2GB cards until today when it fails to recognize them and instead does not pick up any of the files in the card or asks if I want to format the card which will result in loss of data! What should I do? Post relates to: