SQL Command newbie problem

hello,
i am using cr 2011 and am trying to learn how to create sql commands. this is my first attempt.
i created an sql command (select distinct region from customer) using the add command to report dialog box.
i then created a parameter field on the command parameter dialog box.
i was expecting to see this parameter field in the field explorer like the other parameter fields that i've created using the create new parameter dialog box, but i didn't.
i ran the report, but the parameter field (for the sql command) did not pop up.
is this parameter field suppose to work like the other parameter fields?
i can't figure out what i'm doing wrong. i thought i followed the directions in the help file.
any help would be greatly appreciated.
thank you
tracy

Hi Tracy,
Th reason you're not being prompted for the parameter and the reason you don't see it in the Field Explorer is because you actually haven't 'used' it in the command object.
By creating a parameter at the command level, you're actually passing values to the SQL query. Something like this:
select name, id from Emp where dept = {?Parameter_Name}
...where {?Parameter_Name} is the name of the Parameter you create at the command level.
Now, you might ask how do I put it in the command object? After you create the parameter, place the cursor at the command line where you wish to pass values. For eg: In my example I expect users to enter values for Department. So, I place the cursor after *where dept = * and then double-click on the parameter name and it automatically comes in there. Or you can even type it the way I did.
Hope this helps!
-Abhilash

Similar Messages

  • SQL Command problem in Application Express 3.2.0.00.27

    To Oracle Application Express Development Team,
    Yesterday I installed Oracle Application Express 3.2.0.00.27.
    While doing my r&d, I came across one problem in SQL Command.
    For example I wanted to run sql "select * from tab"
    When I checked "Autocommit" checkbox it worked fine.
    But when I unchecked the "Autocommit" checkbox it gave me following error:
    ORA-01003: no statement parsed
    Please check post
    http://www.oraclebrains.com/2009/03/sql-command-problem-in-application-express-3200027/ for more details.
    Cheers

    I can't find the log file (a good indication that something went wrong)
    Here's the transcript of the session...
    SQL> startup upgrade
    ORACLE instance started.
    Total System Global Area 599785472 bytes
    Fixed Size 1288820 bytes
    Variable Size 264242572 bytes
    Database Buffers 331350016 bytes
    Redo Buffers 2904064 bytes
    Database mounted.
    Database opened.
    SQL> @apxpatch.sql
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    Wrote file apxset.sql
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    SQL>
    SQL> @apxldimg.sql
    PL/SQL procedure successfully completed.
    Enter value for 1: C:\Documents and Settings\jtench\Desktop\My Downloads\Oracle\apex_3.2.1
    old 1: create directory APEX_IMAGES as '&1/apex/images'
    new 1: create directory APEX_IMAGES as 'C:\Documents and Settings\jtench\Desktop\My Downloads\Oracle\apex_3.2.1/apex/images'
    Directory created.
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    Commit complete.
    timing for: Load Images
    Elapsed: 00:03:30.03
    Directory dropped.
    SQL>

  • Problem adding data to the CRM /Saas application by running SQL commands

    Hello,
    I've been following the CRM/ Saas tutorial:
    http://www.oracle.com/technology/pub/articles/bobrowski-saas.html
    and I tried to run the SQL commands in the tutorial to populate the TENANTS, CUSTOMERS, TENANT_COLUMNS, and USERS tables and keep on getting an "ORA-00911: invalid character" error.
    I could use the Object Browser page to do this but would like to know how to do this by running a SQL command.
    Has anyone else encountered this problem when trying to populate the tables in the CRM application?
    Thanks
    Linda

    Hello,
    Are you sure you copied it correctly?
    If you try to run 1 create statement, does that work?
    For ex.
    -- USERS
    INSERT INTO users (username, tenant_id)
    VALUES ('MIKE',1);
    INSERT INTO users (username, tenant_id)
    VALUES ('JOE',2);
    COMMIT;
    Does that work? I don't see that many special characters...
    What you may try to do is to change the ; by a /
    for ex.:
    INSERT INTO users (username, tenant_id)
    VALUES ('MIKE',1)
    INSERT INTO users (username, tenant_id)
    VALUES ('JOE',2)
    Regards,
    Dimitri
    -- http://dgielis.blogspot.com/
    -- http://apex-evangelists.com/
    -- http://apexblogs.info/

  • Problem creating a SQL command object and adding it to a Crystal report

    Hi,
    I'm trying to add the following SQL command object with the following sql for MYSQL 5.1
    SELECT lic.id, lic.productionname, comp.companyname, lic.paymentreceiveddate, lic.licenseissuedate,
    IFNULL((SELECT sum(licsong.feequoted) from licensesong licsong where licsong.licenseid = lic.id), 0) as totalfeequoted,
    IFNULL((SELECT sum(licsong.feetax) from licensesong licsong where licsong.licenseid = lic.id), 0) as totalfeetax,
    IFNULL((SELECT sum(licsong.feequoted + licsong.feetax) from licensesong licsong where licsong.licenseid = lic.id), 0) as totalfee,
    IFNULL((SELECT sum(pay.fullamount) from payment pay where pay.licenseid = lic.id),0) as totalpaid
    FROM license lic
    INNER JOIN company comp on lic.licensecompanyid= comp.id;
    This sql runs fine in the Query Browser of mysql and returns what I want.
    When I try to add this SQL command to a new Crystal Report, (by right clicking in the sql editor and selecting Crystal Reports - Add to new Crystal Report), it locks up my Eclipses and it ends up not responding. If I just do a simple SELECT * FROM license it works fine.
    The Eclipse I'm using is from the CR4E download page with the crystal plugin already installed.
    Any help with this would be greatful, as I am not having much joy with this CR4E 2.0 with MySQL and may have to scrap it and go back creating reports in Apache POI.
    Any help greatly received.
    Kind regards

    Hi,
    Try to select a particular columns instead of doing SELECT * FROM license.
    Thanks,
    Saravanakumar

  • Sender JDBC Communication Update SQL Command Problem!

    Hi all,
    I am trying to do a SENDER JDBC Scenario in XI.
    I fetch the Records from the table Once per day based on the Current Date.
    I do not have any Update Credentials in the table.
    I can only perform Select Querry.
    But when i am trying to configure the SENDER JDBC Channel its asking me to enter value for Update SQL Command in Sender JDBC communication channel Process Parameters.
    Its not accepting BLANK or ' * '  Values.
    But i have only Select Querry credentials in the table. I can only pick the values cant Update the tables but.
    In the Above scenario how can i configure the Sender JDBC CC without Updating the Table after fetching the value?
    Please Advice
    Regards,
    Senthilprakash.

    Hi,
    Specify the Update SQL Statement value as .
    http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm
    Thanks
    SaNv...
    Edited by: Sãnthosh Kûmãr  V on Oct 8, 2008 10:44 AM
    Edited by: Sãnthosh Kûmãr  V on Oct 8, 2008 10:45 AM

  • Problems passing timestamp variable to block-SQL command not properly ended

    Can you please help me answer or direct me to resources in answering the following.
    I'm attempting to pass a timestamp variable to a block but am getting errors with every method I've tried yet.
    The example below is attempting to generate a list of all sales dates for orders after the 21st of March 2000.
    DECLARE
    BeginDate Orders.PurchaseDate%TYPE :=to_date('21-3-2000', 'dd-mm-yyyy');
    Target Orders.PurchaseDate%TYPE;
    BEGIN
    DBMS_OUTPUT.PUT_LINE(to_char(BeginDate));
    SELECT Distinct PurchaseDate from Orders into Target WHERE PurchaseDate>BeginDate;
    END;
    When running it - it returns
    ORA-00933: SQL command not properly ended ORA-06512: at line 8Please advise

    -- I"m still trying to get a timestamp into an execute immediate statement.
    Declare
    BeginDate Orders.PurchaseDate%TYPE :=to_date('21-3-2000', 'dd-mm-yyyy');
    var_date Orders.PurchaseDate%TYPE ;
    BEGIN
    DBMS_OUTPUT.PUT_LINE(to_char(BeginDate,'DD.MM.YYYY'));
    sql1 = 'SELECT MAX(PurchaseDate) INTO Target from Orders WHERE PurchaseDate> :var_date';
    Execute Immediate sql1 Using BeginDate;
    DBMS_OUTPUT.PUT_LINE(to_char(Target,'DD.MM.YYYY'));
    END;
    Thanks again for the replies, I'm still not there yet even after re-reading the documentation that applies to this,
    Using what follows below the Execute Immediate line/syntax is the problematic part of this...
    to quote the block line still returning errors.
    This line which would seem natural...
    Execute Immediate sql1 Using BeginDate;returns -- missing keyword
    Modified with this line attempts to pass another variable to the block also errors.
    Execute Immediate sql1 Using BeginDate, var_date;returns -- ORA-01006: bind variable does not exist
    Perhaps I'm not getting some key concept here, but I would think passing a variable into execute immediate would be
    as simple as passing a string or int into a *.bat,*.sh file or function/procedure in any other language.
    And/or I'm missing a key element or understanding to how this syntax should work.
    Thank you very much for your previous replies any other ideas welcome.

  • How to use Java with PL/SQL commands to send an email with attachment

    Apologizes in advance if this is the wrong place to ask the question.
    I need to use Java with PL/SQL commands to send an email with attachment. My java application runs from the command line and does some magic to gather info from an Oracle 11g db. If the DB has sendmail configured, I'd like to send the results of the data gathering as an attachment to the email addresses. I'm not sure how to do this. I've been reading up on on PL/SQL can send email with UTL_SMTP - with attachments. I'm just not sure how to translate that into being triggered by my Java application. Any suggestions or pointers on what I should read would be appreciated.
    Background - I've been programming in Java for 10+ years, but this is my first time using databases. I also have been on these forums for a long time, but lost my profile when it was switched to Oracle.
    Thanks for all help.

    user13726880 wrote:
    The original requirements were put together and given to me, an Oracle newbie. They expected the Java app to use something intrinsic to Oracle and Unix sendmail. To solve my problem, I use a JDBC connection to run some SQL commands. I take that data, format it and send the results by email to the user. By default the requirement is to send it as an HTML attachment using Unix 'sendmail'. So I do that using Runtime exec. I have also added JavaMail functionality as an alternative to sendmail. It works great and as expected.Sounds like a reasonable solution.
    Note however that PL/SQL itself can send email. And PL/SQL can call unix sendmail too.
    However myself I would have done it in java with JavaMail.

  • Possible to change the datasource from a business-view to a Sql Command ?

    Hello,
    When a business view contains a lot of elements it takes a while just to open the report.
    We'd like to keep the BV as the dictionnary, but,
    once the report design completed,
    we'd like to disconnect the business view and replace it by the Sql command which can be seen in the menu option 'show SQL query'.
    Is it possible via the RAS sdk ?
    Did somebody experience this ?
    How to proceed ?
    Thanks a lot
    Alain

    Hi Ted,
    I'm thinking opening a Case for this problem of opening reports based on a big BV.
    We can't really reduce the BV, since it is the dictionnary and we need the whole thing...
    I'm wondering why it is impossible to change the Datasource if the tables and fields underneath are identical.
    Is it impossible to change the fields' mapping ?
    The other solution, as you suggest, is to create a report from scratch, create a new Datasource with the Sql command format, and rebuild the report... I agree it looks like a big job...
    Do you know if it is possible to export the report in XML for instance, change the XML, and then re-import ?
    Thanks for your Help.
    Alain

  • 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 execute stored procedure in the SQL Commands page

    i'm oracle express edition newbie :) i have this stored procedure. it not belong to a package.
    create or replace procedure "LIST_MEMBERS"
    ("MEMBER_CUR" OUT SYS_REFCURSOR)
    is
    begin
    OPEN MEMBER_CUR FOR
    SELECT * FROM members;
    end;
    now, in the SQL Commands page, how to run the stored procedure and return the records. i do this:
    begin
    execute list_members();
    end;
    but i'm getting some errors. just need some immediate help :) thanks!!!

    Example of using a ref cursor:
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure open_cur(c IN OUT SYS_REFCURSOR) is
      2  begin
      3    open c for 'select rownum rn from dual connect by rownum <= 10';
      4* end;
    SQL> /
    Procedure created.
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    c     SYS_REFCURSOR;
      3    v_val NUMBER;
      4  begin
      5    open_cur(c);
      6    loop
      7      fetch c INTO v_val;
      8      exit WHEN c%NOTFOUND;
      9      dbms_output.put_line(v_val);
    10    end loop;
    11    close c;
    12* end;
    SQL> /
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    PL/SQL procedure successfully completed.
    SQL>

  • SQL Command returns multiple records, but I see only one record in report

    I work with Crystal Reports XI R2 SP3 and Oracle 10g R2 database.
    I have an SQL Command that returns multiple records. Command name is "CommDivisionNames" and it returns column "CommDivisionNames.DIVISION_NAME". When I place this field into report details section of the report, I can see all 10 records returned and this is how it should be. I actually need this field to be placed in the report header section, and when I place the field there, then I see only the first record. I set that field as "can grow = true". When I do "browse field data" for this field, I see that all 10 records are there, but only the first one is displayed in report header section.
    I thought that I can place SQL Command field anywhere on the report (page header, footer, details) and that it will always show all records that it returns from the database. Can that be done?
    My "main part" of the report returns different set of records, and that's what I have in "report details" section. I need this list of divisions to be in the report header section, so user can see that the report was executed for DivA, DivC, DivE.
    Thank you,
    Milan

    sharonamt:
    Users select divisions from parameter, but the parameter multi values are division_numbers (1,5,10), not division_names. Division_names are visible in parameter_prompt_window as description, but parameter remembers only numbers and I don't know how I can reuse division_names later in formula.
    I do join for division_numbers and make them into one string variable and pass to sub-report, but I think that I can only get these division_names by calling an SQL command or calling stored procedure.
    If I try to do join({MySQLcommand.DIVISION_NAME}) I get error message "A string array is required here".
    Carl:
    I'm playing with cross-tab and I can use it to see all division_names in the report-header section. Since I need them in only one column or only one row, I have to edit cross-tab object and turn all unneeded border lines to white to make them look invisible. So, cross-tab could be a solution for my problem here.
    Another option could be to re-write my SQL command. Since I've read here that SQL command could be written in the same way as I would write a stored procedure, then I could use a bit more complex code to get all multiple division names from the database table into a local cursor, and then use do-while loop to concatenate them into one string, and then to return that string as one record (like 'DivA, DivB, DivC'), and then it should not be a problem to display only that one record/string in report header. It is my understanding that Crystal Reports can call stored procedure that works with many cursors/recordsets and CR will use only the last recordset from the stored procedure. Do you think it could be done this way?
    Thank you,
    Milan

  • In batch file i want to execute sql commands

    in x.bat file i write the following
    sqlplus user/pass@host @c:\a.sql
    @c:\b.sql
    when i execute this batch file it is connected to the databse
    and the table of a.sql is created in the database.
    but b.sql is not created.
    it is creating only one table
    i want ot create more no of tables with different .sql files
    like @c:b.sql
    @c:c.sql
    @c:d.sql
    please any body help

    The problem you are running into is that SQL Plus only recognizes the first command you have written in the batch file.
    sqlplus user/pass@host
    SPOOL c:\master.log
    @c:\a.sql
    @c:\b.sql
    SPOOL OFF
    SQLPlus will recognize the spool and first sql command, but the batch file gets command back after the first sql command executes and doesn't recognize @c:\b.sql or know what to do with it. To run multiple SQL commands you have to create an external SQL file with all the sql commands in it with the Spool files you want created, then in the batch file you only call the one SQL script.
    Create a master file like so:
    -- Script Name : AllFiles.sql
    SPOOL c:\master.log
    @c:\a.sql
    @c:\b.sql
    SPOOL OFF
    In x.bat
    CALL SQLPlus user/password@database @AllFiles.sql
    This should get you your required results.

  • SQL Server 2008 Execute SQL Task parameter problem

    hi, guys
    i create a very simply package which only Execute SQL task, set the properties as:
    the testing table structure:
    create table t(
    idx int,
    cname varchar(60)
    Execute SQL Task setting:
    [genaral]
    ResultSet: None
    ConnectionType: Ado.net
    connection:LocalHost.APR11.sa1
    SQLsourceType:Direct input
    SQLStatement:delete from t where idx=?
    [parameter mapping]
    variable name: user::idx
    direction: input
    data type: Int32
    parameter name:NewParameterName
    parameter size:-1
    i hardcode the idx=1, but get error:
    SSIS package "test.dtsx" starting.
    Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "delete from t where idx=?" failed with the following error: "Parameter name is unrecognized.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
    Task failed: Execute SQL Task
    SSIS package "test.dtsx" finished: Success.
    help me please.
    Regards.

    Hello,
    Here you go
    http://decipherinfosys.wordpress.com/2008/03/26/running-parameterized-sql-commands-using-the-execute-sql-task-i/
    http://technet.microsoft.com/en-us/library/ms140355.aspx
    if you use ADO.NET then the way Execute SQL task take parameter is different then "?".... you have to use @paramter.. Please check the above link
    Thanks
    http://sqlage.blogspot.com/

  • Password keystrokes won't register in Run SQL Command

    I'm sorry if this has been answered before. I searched but I couldn't find this particular problem. I'm new to Oracle and I'm trying to install it on my computer. I'm used to using the Enterprise Edition that is available at school, so the Express Edition seems so much different.
    In case it is important, I'm running Windows Vista Home Premium (64-bit). When I go to Start > All Programs > Oracle Database 10g Express Edition > Run SQL Command Line, I enter "connect", then it prompts me for a username. I enter "SYSDBA", then it asks me for a password and my keystrokes are not recognized. I tried to just go ahead and enter the password I created when I installed and press ENTER but that didn't work.
    I tried going to the Database Homepage, and I can log in with SYSTEM and my password, but my SQL commands and scripts (from school, that work with the Enterprise Edition) don't work. I get this pop-up window with the title "Enter Bind Variables" and the page itself has a SUBMIT button, but there is nothing else there.
    I'm totally lost. Any help is greatly appreciated.
    Edited by: user10823568 on Apr 1, 2009 11:56 PM

    sysdba is a privilege, not a user. SYS and SYSTEM users have the DBA role privileges, SYS owns the catalog (database, tables, datafile, user and object info, all the metadata).
    The sys and system users can manipulate just about anything in the instance, using a connect sys as sysdba grants the ability to do a few more management tasks (i.e. shut down the database). Its best to only use those database logins when they're really needed (backups, startups, etc) and create other database users for all the other stuff. A quick way to get started is
    connect sys as sysdba; -- or connect / as sysdba;
    create user joe identified by joepasswd;
    grant resource to joe;
    grant connect to joe;
    grant create session to joeThe resource privilege is a quick way to get all the rights needed to create tables, indexes, procedures. There are a couple of rights in resource that most admins don't like to hand out to just anyone but it'll get the joe database user rolling.
    Now on to that "bind variables" dialog, the script that is running needs some input, take a look at the .sql file and there's probably an ampersand in there somewhere- maybe it wants a user name name, just have to figure out what it wants.
    And sqlplus does not echo characters typed in at the password prompt, that's normal.

  • Crystal runs sql command of first sub report in the second sub report ?

    Hi,
    I have report that contains 3 sub reports.
    Each subreport is running his own sql command to retrieve it's data.
    When moving from the first subreport to the 2nd subreport, we see on the oracle that the crystal runs the sql command of the 1st subreport, and then the sql command of the 2nd subreport.
    The results are fine (he ignores the 1st subreport result in the 2nd subreport), but it delays the showing of the 2nd subreport to show.
    Why? The 2nd subreport doesn't need the data of the 1st subreport!
    How do I cancel that????
    BTW - The 3rd subreport is running only his own sql command (As should be).
    Thanks.

    Hello,
    Not without more info about the report and the data. If there is nothing linked from the main report to sub1 then it's going to run and return all data, no filtering. And from the sounds of it to take 5 + minutes per query this is going to affect performance for the whole report.
    You may want to re-evaluate why and what the subreports are used for. If they all use the same data the link them in the main report use groups to sort the data.
    Having subreports in the Details section is asking for performance problems, every record returned will cause the subreport to run. Not knowing what the subs are doing I can't say for sure....
    What you should do also is re-evaluate your Commands for each sub and see if you can do it either in one SQL statement or write a Stored Procedure to do all of the data collection. DB Servers are much more efficient at collecting data than CR will ever be. Pushing just the results to CR makes it simply formatting the results in the Designer and no performance hits....
    Talk to your DBA on how to optimize your Command SQL's and how to get them into one SQL or into a SP that dumps the final results into a final SQL * from TEMP Table into Crystal.
    Don

Maybe you are looking for