Query help in sql commands

using apex 4.1 i'm entering the following query in the sql command window and I keep getting a pop-up for Entering Bind Variable. I'm not using bind variables though, anyone else see this issue before?
SELECT A.FIRST,A.LAST,A.COMPANY AS CNAME,
J.TOT_MAN_HOURS,
J.ACREAGE,
W.NUM_WORKERS,
W.START_DT
FROM EW_ACCOUNTS A, EW_WORK_ORDER W, EW_JOBS J
WHERE A.ID = J.ACCT_ID
AND J.JOB_ID = W.JOB_ID
AND W.START_DT >= SYSDATE
AND W.START_DT < SYSDATE+1
ORDER BY W.START_DT

I tried that and it didn't seem to help either.
Funny though, if I write a new query against just one of the tables and write out each column name. it works. If I use the * instead of writing each column name, I have the same issue.
This is in apex.appshosting.com free demo environment. I sent them an email asking about it and they told me it was a code issue and they don't support the demo environment.

Similar Messages

  • Query running on sql commands prompt not running on report region

    Hi All,
    Facing a weird issue now. I have written a report query which is running absolutely fine in sql command prompt but when i trying to run this as a report it is just processing and the report is not loading. What could be the reason behing this?
    Thanks in Advance
    Regards

    Hi,
    With no other information about the problem is hard to know what's happening. If you could at least provide us with the query then I think it would be easier for us to help you.
    Regards,
    Sergio

  • How to use lengthy query in a "SQL Command from Variable"

    My oracle SQL Query length is more than 14000 characters, so how can i use this for "SQL command from variable".
    Sarvan

    Either create a view or a table valued UDF. Using stored procedure in OLEDB source has some gotchas it will not pick up metadata information by default due to late binding.
    http://consultingblogs.emc.com/jamiethomson/archive/2006/12/20/SSIS_3A00_-Using-stored-procedures-inside-an-OLE-DB-Source-component.aspx
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How do i get a output in CSV of a SQL query executed via SQL Command prompt

    Hi All,
    I have a question with reference to SQL command prompt. I have a sql query which runs properly and gives proper execution in SQL Management console in GUI.
    This report is used to pull the free disk space report of our servers
    As i want to schedule it as a report so i want to script it to run via SQL command prompt. I made the script and it works fine if i enter it in SQL command prompt. When i try to extract the output to a CSV File it fails. Below is the details of the command
    i am using to query to pull the data. Can anyone help me in getting the output of this query in SQL command prompt.
    sqlcmd -W -s , -S Servers FQDN
    use operationsmanager
    Go
    Query:"select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "C:\DataSqlCmd.csv"
    Go
    When i enter the command without the quotes when the query is starting and ending and also without the output command (-s "," -o "C:\DataSqlCmd.csv") it is working and shows the output in the command prompt. Below is the screen shot for
    your reference.
    Due to security reasons i have to erase the server names:
    But when i add the line to extract the output ( -s "," -o "C:\DataSqlCmd.csv") It gives me this error:
    The exact command would be:
    sqlcmd -W -s , -S CINMLVSCOM01.e2klab.ge.com
    use operationsmanager
    Go
    "select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "C:\DataSqlCmd.csv" -h-1
    Go
    saying the syntax is not correct or some thing as per the below screenshot.
    Can any one please help. Below is just the query whi i use to get the output in SQL management studio.
    Can any one make a command for the below quer so i can directly execute and test for getting the output.
    select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled
    Gautam.75801

    Can you try the below query?
    select Path, InstanceName, SampleValue
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < 20 and CounterName like '% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled
    -- replace the below query part in the below SQLCMD C:\>SQLCMD -S SERVERNAME -E -d operationsmanager -Q "select * from sys.databases ds with (nolock) where name='master'" -s "," -o "F:\PowerSQL\MyData.csv" -h -1
    SQLCMD -S SERVERNAME -E -d OperationsManager -Q "select Path, InstanceName, SampleValue
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "c:\MyData.csv" -h -1
    Refer for the other ways 
    http://dba.stackexchange.com/questions/23566/writing-select-result-to-a-csv-file
    --Prashanth

  • Need help on Sql command for count

    Hi,
    I have the following table.
    Temp_Set Table
    ID Names Action
    1 John Delete
    2 John Add
    3 Mary Update
    4 Sim Add
    5 Sim Update
    How do I do a SELECT sql command for count(names) > 1 ?
    Please kindly advise me. Thank you very much.

    It doesnt work when I do this
    SELECT * FROM Temp_Set
    HAVING Count(names) > 1
    It prompts me the following error:
    ORA-00937: not a single-group group function
    00937.00000 - "not a single-group group function"
    *Cause:
    *Action:
    Error at Line:16 Column:7i am not sure but you can try this:
    SELECT B.* FROM
    (SELECT NAMES, COUNT(1) CNT FROM TEMP_SET GROUP BY NAMES) A, TEMP_SET B
    WHERE A.NAMES = B.NAME
    AND CNT > 1

  • Need Help in SQL command LIKE !

    Hi all,
    plz go through the following sql statement :
    select last_name
    from employees
    where last_name like '%a%e%' or last_name like '%e%a%';
    This gives an output where the last_name contains a or e in it.
    Now what would be the best solution to find the records in a table where last_name contains a,e,i,o,u (in anyorder). Do I need to write all the combinations ? Or is there any solution.
    Thanks,
    Sandeep

    Thnaks all for your help. However, the issue is not yet resolved.
    Ok let me more clear.
    Now consider a table called Employees which has a column called LAST_NAME.
    All the last_names in that column are of 10-20 letters. I want to findout the names
    which has the letters q,o,p,r,s (in anyorder).
    What would be the SQL statment ? From my point of view, I have to use LIKE keyword and use different combinations like '%q%0%p%r%s' or '%o%p%q%r%s' .,.....etc.
    Or do we have any other better solution ?
    Thnaks a lot for your solutions

  • Please help with SQL command

    Hi,
    I'm trying to update a record but I don't know how to update one field in this record. This is my code so far
    private void updateProcess() {
    int nrows;
    String sql = "UPDATE student SET s_first = '" + txtS_first.getText()
         + "', s_mi = '" + txtS_mi.getText()
         + "', s_last = '"      + txtS_last.getText()
         + "', s_dob = TO_DATE('" + txtS_dob.getText() + "', 'MM/DD/YYYY')"
    /* In a database table, after the s_dob column is f_id column, but a user will see info of this field by f_first and f_last instead of f_id. How can I update this column with f_id if a user's input is f_first and f_last? What if f_first and f_name that a user enters doesn't exist in the database, is there anyway to display an error for this case?
         + "', f_first = '" + txtF_first.getText()
         + "', f_last = '" + txtF_last.getText()
         + "' WHERE s_id = " + txtS_id.getText();
    try {
         nrows = stmt.executeUpdate(sql);
    // I think this part I'm doing wrong because the text area doesn't display these strings
         if(nrows > 0) {
         lblShowResult.setText("Update successed");
         lblShowResult.setVisible(true);
    } // end if
    else {
         lblShowResult.setText("Update failed");
    lblShowResult.setVisible(true);
    } // end else
         rset.close();
    } // end try
    catch (SQLException e) {}
    catch (NullPointerException e){}
    } // end updateProcess

    If you read the docs for executeUpdate, you'll see that it returns the number of rows affected. So if it returns zero, then no rows matched.
    Also, you should be using PreparedStatement rather than Statement. Then you won't have to worry about weird characters in strings or formatting dates (you can just give it a java.sql.Date object).

  • Help with sql command for inventory cost change report

    Inventory Cost Changes within date range.
    Columns on report
    Item LastDateChanged CurrentCost PriorCost
    Source File-TransHst (Type 14 is inventory cost change)
    example data
    Type,Item,DtChg,Cost
    14,15825,02/01/2014,357.00
    14,45832,03/15/2014,95725.00
    14,15825,10/01/2013,322.00
    14,45832,06/22/2012,94632.00
    example output needed
    Item   LastDateChanged CurrentCost PriorCost
    15825     02/01/2014                 357.00               322.00    
    Using Crystal Reports 2008 with Oracle Database
    I cannot create sql to retrieve data to create report.
    Need Item, Last Change Date, Current Cost and Prior Cost as output of sql
    Thanks

    HI Jerry,
    I don't know real syntax of your database, try below SQL, you may have to modify the syntax wherever it is required.
    Select t.Item, Max(t.DtChg),(case when year(t.dtchg) = Year(sysdate) then t.Cost else 0) as currentCost,
    (case when year(t.dtchg) = Year(sysdate)-1 then t.Cost else 0) as PriorCost
    From TransHst t
    Where Type=14
    Group by t.Item
    Thanks,
    Sastry

  • Error in SQl Query - SQl Command not properly ended

    Hi All
    I have this SQL query that returns the following error when I run it in TOAD:
    SELECT
    VC.CAMPAIGN_NUMBER,VC.CAMPAIGN_TITLE,VC.CAMPAIGN_DESC,
    VCV.START_DATE, VCV.END_DATE,VC.CAMPAIGN_TYPE,VC.APPLICABILITY,
    VC.CAMPAIGN_PRIORITY
         FROM
         VM_CAMPAIGN_VIN VCV ,VM_CAMPAIGN VC
         WHERE
              VCV.VIN = 'US'
              AND
    VCV.CAMPAIGN_NUMBER = VC.CAMPAIGN_NUMBER AND VC.COUNTRY_CODE = 'E'
              AND VC.LANGUAGE_CODE = 'L' AND VC.CAMPAIGN_TYPE = null
    AND SYSDATE BETWEEN VCV.START_DATE AND VCV.END_DATE
    AND SYSDATE BETWEEN VC.START_DATE AND VC.END_DATE)
    A ORDER BY A.CAMPAIGN_PRIORITY DESC, A.END_DATE
    The error is:
    SQl Command not properly ended
    Any help is highly appreciated. Thanks

    Thanks a lot to everyone. It helped me run the query without any problem. Now I have another issue. This may not be the right place to post this question, I think.My apologies for that. The problem is, Weblogic posts an error as follows:
    java.sql.SQLException: ORA-00923: FROM keyword not found where expected
    I am wondering if this is an Java related error or an SQL related error.
    Well, I am using the SQL Statement which you helped debug, and it is inside something called "XXSQLConstants.java consisting of the following SQL statement:
    public static final String XX_ALL_CAMPS_SELECT = "SELECT * FROM" +
         "(SELECT vc.campaign_number, vc.campaign_title, vc.campaign_desc, vc.start_date," +
         "vc.end_date, vc.campaign_type, vc.applicability, vc.campaign_priority" +
    "FROM vm_campaign vc" +
    "WHERE vc.applicability = 'Y'" +
    "AND vc.country_code = ? " +
    "AND vc.language_code = ? " +
    "AND vc.campaign_type = ? "+
    "AND SYSDATE BETWEEN vc.start_date AND vc.end_date" +
    "AND NOT EXISTS (" +
    "SELECT 'X'" +
    "FROM vm_campaign_vin vcv" +
    "WHERE (vcv.vin = ? " +
    "AND vcv.campaign_number = vc.campaign_number" +
    "))" +
         "UNION" +
         "SELECT vc.campaign_number, vc.campaign_title, vc.campaign_desc," +
         "vcv.start_date, vcv.end_date, vc.campaign_type, vc.applicability," +
    "vc.campaign_priority" +
    "FROM vm_campaign_vin vcv, vm_campaign vc" +
    "WHERE vcv.vin = ? " +
    "AND vcv.campaign_number = vc.campaign_number" +
    "AND vc.country_code = ? " +
    "AND vc.language_code = ? " +
    "AND vc.campaign_type IS NULL" +
    "AND SYSDATE BETWEEN vcv.start_date AND vcv.end_date" +
    "AND SYSDATE BETWEEN vc.start_date AND vc.end_date)";
    The SQl runs fine when tested (well, it does not return any data for the rows returned, but there are no errors), but in my application server I get the following error (pointing out the same SQL code pasted above:
    java.sql.SQLException: ORA-00923: FROM keyword not found where expected
    Any suggestions? Thanks in advance. I appreciate all replies

  • Command query & help

    dear all .,
    can any one tell how can i query and get help of any command
    that i want to see like i need to know all the commands started
    with ALTER DATABASE for example .,
    thanks
    [email protected]
    [email protected]

    Hi,
    Refer to SQL Reference section in Oracle Documentation . it
    gives complete options of all commands.
    also if you have Oracle DBA Handbook (by kevin loney)you can
    find full description of this command at the refernce section,
    if you don't have this book, it is better you get one.
    Vadivel

  • Copying Access Queries to Query Builder instead of SQL Commands

    Is there a way to copy Microsoft Access Queries to Query Builder (saved sql) instead of SQL Commands (saved sql)...Thanks in advance.

    Hello,
    No, that functionality does not exist currently, you would need to build your own.
    If you search this forum there are a few threads which detail how you can install the Application Builder and SQL Workshop applications into the APEX environment itself so you can see how they (meaning the Oracle team) have built those apps.
    Hope this helps,
    John.
    http://jes.blogs.shellprompt.net
    http://apex-evangelists.com

  • Schema name added to SQL query after SQL Command

    Post Author: rickeb1
    CA Forum: Data Connectivity and SQL
    Hello,
    I am using Crystal Reports XI.  I have created a Crystal report in the usual manner using a set of tables from a given database schema. When I look at the SQL query that Crystal generates, there are no data schema qualifiers anywhere.
    Then I added an SQL Command object that I use as an additional table. Now when I look at the generated SQL query, the data schema name is added to the beginning of the original query as well as to the new SQL Comand code. It also creates an EXTERNAL JOIN which uses this hard-coded schema name (not exactly sure what an "external join" is).
    This hard-coding of the schema name is causing a problem when we try to migrate the report to a different environment. Is there some way to avoid having Crystal generate a query with the schema name imbedded in the query, or is there a way to remove it after it is generated?
    Thanks!

    Post Author: rickeb1
    CA Forum: Data Connectivity and SQL
    Actually, our problem may be related to this:
    http://boardreader.com/t/Crystal_XI_249231/The_Show_SQL_Query_SQL_command_changes_89667.html
    Any help greatly (and desparately) apapreciated!

  • SQL Query Help - Is this possible or impossible????

    Hi guys,
    I need help with an SQL query that I'm trying to develop. It's very easy to explain but when trying to implement it, I'm struggling to achieve the results that I want.....
    For example,
    I have 2 tables
    The first table is:
    1) COMPANY create table company (manufacturer varchar2(25),
                                                          date_established date,
                                                          location varchar2(25) );My sample test date is:
    insert into company values ('Ford', 1902, 'USA');
    insert into company values ('BMW', 1910, 'Germany');
    insert into company values ('Tata', 1922, 'India');The second table is:
    2) MODELS create table models (manufacturer varchar(25),
                                                 model varchar2(25),
                                                 price number(10),
                                                 year date,
                                                 current_production_status varchar2(1) ) ;My sample test data is:
    insert into models values ('Ford', 'Mondeo', 10000, 2010, 0);
    insert into models values ('Ford', 'Galaxy', 12000,   2008, 0);
    insert into models values ('Ford', 'Escort', 10000, 1992, 1);
    insert into models values ('BMW', '318', 17500, 2010, 0);
    insert into models values ('BMW', '535d', 32000,   2006, 0);
    insert into models values ('BMW', 'Z4', 10000, 1992, 0);
    insert into models values ('Tata', 'Safari', 4000, 1999, 0);
    insert into models values ('Tata', 'Sumo', 5500,   1996, 1);
    insert into models values ('Tata', 'Maruti', 3500, 1998, 0);And this is my query:
    SELECT
            com.manufacturer,
            com.date_established,
            com.location,
            DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.model),
            DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.price),
            DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.year),
            mod.current_production_status
    FROM
           company com,
           models mod
    WHERE
          mod.manufacturer = com.manufacturer
          and com.manufacturer IN ('Ford', 'BMW', 'Tata')
          and mod.current_production_status IN (1,0)
    ORDER BY
            mod.current_production_status DESCWhat I want the query to output is this:
    com.manufacturer        com.date_established          com.location          mod.model          mod.price             mod.year     mod.current_production_status
    Ford               1902                    USA               Escort               10000               1992          1
    BMW               1910                    Germany               -               -               -          0
    Tata               1922                    India               Sumo               5500               1998          1If current_production_status is 1 it means this particular model has been discontinued
    If current_production_status is 0 it means the manufacturer does not have any discontinued models and all are in procuction.
    The rule is only one record per manufacturer is allowed to have a current_production_status of 1 (so only one model from the selection the manufactuer offers is allowed to be discontinued).
    So the query should output the one row where current_production_status is 1 for each manufacturer.
    If for a given manufacturer there are no discontinued models and all have a current_production_status of 0 then ouput a SINGLE row that only includes the data from the COMPANY table (as above). The rest of the columns from the MODELS table should be populated with a '-' (hyphen).
    My query as it is above will output all the records where current status is 1 or 0 like this
    com.manufacturer        com.date_established          com.location          mod.model          mod.price          mod.year     mod.current_production_status
    Ford               1902                    USA               Escort               10000               1992          1
    Tata               1922                    India               Sumo               5500               1998          1
    Ford               1902                    USA               -               -               -          0                    
    Ford               1902                    USA               -               -               -          0
    BMW               1910                    Germany               -               -               -          0
    BMW               1910                    Germany               -               -               -          0
    BMW               1910                    Germany               -               -               -          0
    Tata               1922                    India               -               -               -          0
    Tata               1922                    India               -               -               -          0However this is not what I want.
    Any ideas how I can achieve the result I need?
    Thanks!
    P.S. Database version is '10.2.0.1.0'

    Hi Vishnu,
    Karthiks query helped...
    But this is the problem I am facing...
    SELECT
            com.manufacturer,
            com.date_established,
            com.location,
            DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.model),
            DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.price),
            DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.year),
            mod.current_production_status
    FROM
           company com,
           models mod
    WHERE
          mod.manufacturer = com.manufacturer
          and com.manufacturer = 'Ford'
          and mod.current_production_status IN (1,0)
    ORDER BY
            mod.current_production_status DESCThe value of:
    and com.manufacturer = 'Ford'will be dependent on front end user input....
    When I run the query above I get all the rows where current_production_status is either 1 or 0.
    I only require the rows where current_production_status is 1.
    So if I amend it to look like this:
         and mod.current_production_status = 1This works....
    BUT if a user now passes in more than one manufacturer EG:
    and com.manufacturer IN ('Ford', 'BMW')The query will only return the one row for Ford where current_production_status is 1. However because BMW has no models where current_production_status is 1 (all 3 are 0), I still want this to be output - as one row....
    So like this:
    com.manufacturer        com.date_established          com.location          mod.model          mod.price             mod.year     mod.current_production_status
    Ford               1902                    USA               Escort               10000               1992          1
    BMW               1910                    Germany               -               -               -          0So (hopefully you understand), I want both cases to be catered for.....whether a user enters one manufacturer or more than one...
    Thanks you so much!
    This is really driving me insane :-(

  • Order in a query in SQL Command Processor

    Hi all
    I'm trying 'HTML DB 1.6' @htmldb.oracle.com.
    Now when i run a simple query against a table in the 'SQL Command Processor', the order by doesn't work proparly. It seems that the ORDER BY clause is ignored.
    Here is the query:
    SELECT ng
    FROM ges_rep_adr
    ORDER BY ng
    By the way the same happens in a report.
    Has anybody an idea what's the problem?
    Thanks in advance and best regards
    Martin

    Martin,
    Try:  select replace(substr(ng,1,1),' ','!')||substr(ng,2) from ges_rep_adr order by ngto see the cases where a leading space character in the output is not rendered visually and leads you to conclude that the rows are sorted wrong. If that's not it, let us know.
    Scott

  • Can I use multiline SQL commands in a query (within a component)?

    I would like to modify the following query:
    <td>ItranslationString</td>
         <td>
         INSERT INTO TRANSLATIONSTRINGS (daKey, daLanguage, daTranslation, daStringFlag, daSourceFile) VALUES (?, ?, ?, 'N', ?)
         </td>
         <td>daKeyField varchar
         daLanguageField varchar
         daTranslationField varchar
         StringTranslationFilename varchar
         </td>
    so that the daSourceFile a) is selected from another record, if it exists b) uses the constant, if not.
    In SQL Command the commands (without placeholders) look:
    declare c integer;
    res varchar(30);
    key_var varchar(100);
    def_lang_var varchar(5);
    begin
    key_var := 'newString';
    def_lang_var := 'en';
    res := 'ap_string.htm';
    select count(*) into c FROM TRANSLATIONSTRINGS WHERE daKey = key_var AND daLanguage = def_lang_var;
    if c > 0 then
    select daSourceFile into res FROM TRANSLATIONSTRINGS WHERE daKey = key_var AND daLanguage = def_lang_var;
    end if;
    INSERT INTO TRANSLATIONSTRINGS (daKey, daLanguage, daTranslation, daStringFlag, daSourceFile) VALUES (key_var, 'cs', 'translation', 'N', res);
    end;
    However, such a query does not work in the query resource (multiline commands cannot be used?).
    Neither can I think of one line query that would provide the same functionality (tried to test with COALESCE).

    Yes, I got the point. The query looks like:
    INSERT INTO TRANSLATIONSTRINGS (daKey, daLanguage, daTranslation, daStringFlag, daSourceFile)
    SELECT daKey, daLanguage, daTranslation, daStringFlag, daSourceFile FROM (
    select 'newString1' daKey, 'en' daLanguage, 'transl' daTranslation, 'N' daStringFlag, daSourceFile FROM TRANSLATIONSTRINGS WHERE daKey = 'newString1' AND daLanguage = 'cs' UNION ALL SELECT 'newString1' daKey, 'en' daLanguage, 'transl' daTranslation, 'N' daStringFlag, 'default' daSourceFile FROM DUAL)
    WHERE rownum<=1;
    so that's the way how to solve it via SQL.
    (Since I can't use DECLARE, I need to bind entry parameters as many times as they appear in the query - not a very nice way, but it works).
    The question still is, whether there is a way how to use a multiline query in Component Queries. Even though it is not mentioned specifically in the documentation, it seems it is NOT to be possible by design. So the real question is really WHY - I guess it would be a little bit more convenient to begin/commit transactions, use variables, etc. in a multiline query.
    Yet, Sam, thanks!

Maybe you are looking for