Problem in running sql query

Hello ,
I am using oracle 10g apex 3.2.
I have assosiated 2 schema "vpmys and vp" with one workspace.
In the application , i created a new page of report ,which is assosiated with one schema called "vp" and i wish to run this query
select * from vpmys.t_devotees
minus
select * from vp.t_devotees
Same database dmp is installed in both schema except that the no of rows may be more or less in one database.So first i need to know the added rows and what are they and then insert the same no of rows into another db.
But this doesnt run in the application.
But it runs in the SQL Command window.
So what way i should change the query so that it runs.
Thanks
Swapna

Post your question in Application Express Forum
Oracle Application Express (APEX)

Similar Messages

  • Need checkbox onclick somehow to run SQL query

    Hello all,
    Now, I know directly I cannot do this with a javascript function.  What I need to do is with a checkbox onclick
    set a hidden field to the type of the data that is selected by the checkbox.  So, if I select the name of a person,
    the onclick method needs to let the hidden field know we have a "person" entity type. I need this type because
    when I do my true submit, that form field when read will denote what next page I need to bring up in a new tab.
    The question I have is ok, I can attempt to do this a couple of ways, following:
    1)  Come up with an AJAX call that will run a function on the server.  What I do worry about is
    submitting the page and ending up losing boxes that were checked.  I also don't want a long
    form submittal after every click.
    OR
    2)  Forget the onclick method, create a blank .cfm form, then use that form to run the query for the
    types of data, and then call the page to be displayed?  Again, I'm new, so I don't know if this could
    be weird in how the page comes up for display?
    Thanks in advance!!!!!

    Hey Dan,
    Yep, I'm very new at using CF, so I pretty much stink at it compared to you all.  However, I fixed my one problem in that I don't need
    to do anything with SQL queries with onclick.  I combined a bunch of forms into one and process stuff on that page.  Matter of fact,
    I needed to do that.
    However, what I do have a problem with is one last part of my keeping checkbox values when paging.  I can do almost everything,
    meaning, keep track of checkbox values when checked by having a list of those values in session.  I can check the boxes when
    I go back to the page with a simple <CFIF> block when the checkboxes are created for the page.
    The issue I have now is how I can delete a value from the session list when a checkbox is unchecked.  I don't know if I should
    keep track of the exact page number, or whatnot.  All I have now is a list of node ids.
    Any ideas?
    Thanks,
    Ed

  • Problem in running the query on ODS

    Hi All,
    I have been trying to run the query which consists of only 25 fields and doen't contain much calculations and routines and trying to restrict even 7000 records.
    That too result in system failure reporting on storage parameters somtimes giving dump as well.
    Could you please suggest me the solution for this as this is urgent requirement.
    Thanks
    Suryam

    Hi,
    Are you using a filter / restrictions in the query,if So create a Secondary index which can be suitable(same order) to this filterations/restrictions.
    You can find the order in where cluase in the sql statement used in the query execution.you can see it in SM50.
    With rgds,
    Anil Kumar Sharma .P

  • Problem while running BEx Query

    Hi All,
    I had reqiurement of calculating the difference of the two dates.I calculated Date Difference but I am getting problem when I run the Query.
    The problem is " I am finding the difference between Schedule Line Date and Posting Date. There are some blank spaces in the cube over Schedule Line Date and also over Posting Date. While running the Query Blank Space is taken as # symbol and while calculating the differences it is giving the differences in Lakhs."
    Can anybody help me to solve the problem " To remove the # symbol and calculate the differences properly".
    Thanks in advance.
    With Regards
    Mahi

    Hi,
    Use the Boolean concept like below:
    I hope you are using formula varibles to get Dates into the formula.
    Lets assume fv1 is formulavarible on Schedule line date and FV2 is Formula varible on Posting date.
    (FV1 == '' OR FV2 == '') * 0 + (FV1 <> '' AND FV2 <> '') * (FV1-FV2).
    With rgds,
    Anil Kumar Sharma .P

  • Problem with running a query

    I'm having problem running a query when I use my own userid. The query runs fine when I log on as the owner of the tables. but when I use my own userid ( I have all the privileges to all the tables, snapshots, views needed by the query ) then the query just sits there doing nothing.
    We are currently using Oracle8.0.5.
    Anybody know what the problem might be. shouldn't the query use the same path of execution no matter who runs the query.
    Any suggestions anyone ???

    Hi,
    I think the temporary tablespace is the root cause in your case.
    Pl. specify a different temporary tablespace for sorting activities for your user and things should be fine.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by bangal13 ():
    I'm having problem running a query when I use my own userid. The query runs fine when I log on as the owner of the tables. but when I use my own userid ( I have all the privileges to all the tables, snapshots, views needed by the query ) then the query just sits there doing nothing.
    We are currently using Oracle8.0.5.
    Anybody know what the problem might be. shouldn't the query use the same path of execution no matter who runs the query.
    Any suggestions anyone ???<HR></BLOCKQUOTE>
    null

  • Problem writing a sql query for a select list based on a static LOV

    Hi,
    I have the following table...
    VALIDATIONS
    ID          Number     (PK)
    APP_ID          Number     
    REQUESTED     Date          
    APPROVED     Date          
    VALID_TIL     Date
    DEPT_ID          Number     (FK)
    I have a search form with the following field item variables...
    P11_DEPT_ID (select list based on dynamic LOV from depts table)
    P11_VALID (select list based on static Yes/No LOV)
    A report on the columns of the Validations table is shown based on the values in the search form. So far, my sql query for the report is...
    SELECT v.APP_ID,
    v.REQUESTED,
    v.APPROVED,
    v.VALID_TIL,
    d.DEPT
    FROM DEPTS d, VALIDATIONS v
    WHERE d.DEPT_ID = v.DEPT_ID(+)
    AND (d.DEPT_ID = :P11_DEPT_ID OR :P11_DEPT_ID = -1)
    This query works so far. My problem is that I don't know how to do a search based on the P11_VALID item - if 'yes' is selected, then the VALID_TIL date is still valid. If 'no' is selected then the VALID_TIL date has passed.
    Can anyone help me to extend my query to include this situation?
    Thanks.

    Hello !
    Let's have a look at my example:create table test
    id        number
    ,valid_til date
    insert into test values( 1, sysdate-3 );
    insert into test values( 2, sysdate-2 );
    insert into test values( 3, sysdate-1 );
    insert into test values( 4, sysdate );
    insert into test values( 5, sysdate+1 );
    insert into test values( 6, sysdate+2 );
    commit;
    select * from test;
    def til=yes
    select *
      from test
      where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
           =decode('&til','yes',1,-1);
    def til=no
    select *                                                                               
      from test                                                                            
      where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
           =decode('&til','yes',1,-1);  
    drop table test;  It's working fine, I've tested it.
    The above changes to my first idea I did because of time portion of the DATE datatype in Oracle and therefore the wrong result for today.
    For understandings:
    1.) TRUNC removes the time part of DATE
    2.) The difference of to date-values is the number of days between.
    3.) SIGN is the mathematical function and gives -1,0 or +1 according to an negative, zero or positiv argument.
    4.) DECODE is like an IF.
    Inspect your LOV for the returning values. According to my example they shoul be 'yes' and 'no'. If your values are different, you may have to modify the DECODE.
    Good luck,
    Heinz

  • How to run sql query in bat file in task schedular at every 10 seconds

    This is my sql script :
    DECLARE @countRows INT,
    @currDate DATE,
    @checkForTasks INT,
    @created_by_id INT,
    @gst_ID int;
    SET @currDate = Getdate()
    SET @countRows = (SELECT Count(*)
    FROM [dbo].[sd_gst_effective_table]
    WHERE isapplied = 0)
    IF @countRows > 0
    -- Check for those GST''s who are not applied yet : if they are greater than 0 then perform next task
    BEGIN
    SET @checkForTasks = (SELECT Count(*)
    -- Check is current date equals to task date or not
    FROM [dbo].[sd_gst_effective_table]
    WHERE effect_date = @currDate AND isapplied = 0)
    IF @checkForTasks > 0
    -- If current date = task date then perform this task
    BEGIN
    SET @created_by_id = (SELECT TOP 1 createdby FROM [dbo].[sd_gst_effective_table] WHERE effect_date = @currDate AND isapplied = 0)
    SET @gst_ID = (SELECT gst_id FROM [dbo].[sd_gst_effective_table] WHERE effect_date = @currDate AND isapplied = 0)
    -- STEP 1 :: InActivate the existing GST according to createdbyID
    UPDATE sd_gst_rate
    SET isactive = 0,
    inactivedate = Getdate()
    WHERE isactive = 1
    AND createdby = @created_by_id
    -- STEP 2 :: Activate the New GST according to implementation date and gstID
    UPDATE sd_gst_rate
    SET isactive = 1,
    activedate = Getdate()
    WHERE id = @gst_ID
    -- STEP 3 :: Inactivate the applied GST from sd_gst_effective_table
    UPDATE [dbo].[sd_gst_effective_table] SET isApplied = 1 WHERE gst_id = @gst_ID
    END
    END
    DECLARE @Text AS VARCHAR(100)
    DECLARE @Cmd AS VARCHAR(100)
    DECLARE @value nvarchar(1000);
    SET @value = (SELECT CONVERT(TIME,GETDATE()) AS HourMinuteSeconds);
    SET @Text = 'File Writed ' + @value
    SET @Cmd ='echo ' + @Text + ' > E:\AppTextFile.txt'
    EXECUTE Master.dbo.xp_CmdShell @Cmd
    This is resided in videos folder of windows , i have created a task schedular in windows 8.1 to run daily at every 10 seconds , but it is not working ... Please tell me how to deal with it.
    Please note : This sql query is running perfectly in sql server. Query have no errors. Please check whats wrong with my time schedular. I just want my schedular to run every 10 seconds regardless of date.

    Hi Emad,
    Is your script in a ".sql" file? May I know how you configure the schedule task action?
    Since you didn't mention how you configure the schedule task, can you confirm you have followed the below step correctly?
    Save your script in a ".sql" file.
    Create a ".bat" file and call the sql file above inside with
    sqlcmd.exe, you can reference
    here.
    Configure a schedule task to run the ".bat" file in a certain interval.
    Have you tried to run the script in you bat file in a standalone commandline window? Please post the script in your bat file, It can help to diagnose the issue.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Mapping Problem with Native SQL query

    My application uses a native SQL query to locate certain entities. It looks like this:
    SELECT UPLOADATTEMPTREF, STUDENTNUMBER, USERID, WORKITEMCODE, WORKITEMINSTURN, WORKITEMTITLE, MODULERUNCODE, STUDENTNAME, SUBMISSIONDEADLINE, UPLOADATTEMPTSERVERDATE, FILENAME, UPLOADCOMPLETESERVERDATE, NEWFILENAME, FILESIZE, FILEPATH, DOWNLOADSERVERDATE, MODULECODE, MODULETITLE
    FROM Submission_Attempt WHERE UPLOADATTEMPTREF IN (
    SELECT uploadAttemptRef FROM (" +<br /><br />                         "SELECT MAX(uploadAttemptRef) AS uploadAttemptRef, UserID, workItemInstUrn, " +<br /><br />                         "workItemCode FROM Submission_Attempt where workiteminsturn = ?1 " +<br /><br />                         "GROUP BY UserID, workItemInstUrn, workItemCode) Table1 ) " +<br /><br />                         "and uploadCompleteServerDate is not null;"<br />
    My expectation was that EclipseLink would be able to handle the mapping of the results to the entity quite happily. However, I get a NonSynchronizedVector of Objects - each Object representing one field of data.
    I need help with either:
    Converting the above SQL into JPQL so that I (hopefully) don't have to worry about the SQL or
    Understanding why this isn't working properly...
    Anyone able to help?
    Edited by: phunnimonkey on Nov 6, 2008 3:33 AM

    Never mind - the problem was to do with not specifying a class when creating the native query.

  • Problem executing a sql query in 10g environment

    Hi,
    I am having problem executing the following sql query in 10g environment. It works fine in 8i environment.
    I tried to_number(to_char) and it did not work.
    **A.APPL_ACTION_DT >= TO_CHAR("&v_strBeginStatusDate&", 'DD-MON-YYYY') AND A.APPL_ACTION_DT <= TO_CHAR("&v_strEndStatusDate&", 'DD-MON-YYYY')))**
    Any suggestions..
    --Pavan                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    I would be surprised if that worked in 8i as posted, although I no longer have 8i to test. You do not tell us the error message you are getting, but there are several things wrong with what you posted.
    First, the substitution variable requires only the & at the beginning, you have one on each end of your string, the one at the end will remain in the string that is passed to the database.
    Second, you cannot TO_CHAR a string with a date format as you are trying to do. The TO_CHAR function is overloaded and has two basic forms TO_CHAR(date, format_model) and TO_CHAR(number, format_model). Note that neither takes a string. It would appear that at least current versions of Oracle choose the second signature unless specifically passed a date datatype.
    SQL> select to_char('&h', 'dd-mon-yyyy') from dual;
    Enter value for h: 12
    old   1: select to_char('&h', 'dd-mon-yyyy') from dual
    new   1: select to_char('12', 'dd-mon-yyyy') from dual
    select to_char('12', 'dd-mon-yyyy') from dual
    ERROR at line 1:
    ORA-01481: invalid number format modelalthough I suspect that the error you are getting with your posted code is more likely to be ORA-01722: invalid number.
    Depending on the data type of appl_action_date, you are probably lokoing for TO_DATE instead of TO_CHAR.
    John

  • Problem in making SQL Query

    Hello All,
    I have one problem regarding sql query.
    I have one internal table which contains equnr and bis as fields. There are two database tables egerr and eastl. The structure for tables are as follows:
    Fields for egerr:
    equnr, bis, logiknr in which first two fields form key.
    Field for eastl:
    anlage, bis, logiknr in which all fields form primary key.
    I want to select records from internal table which does not have record in eastl.
    For the reference we can extract logiknr from egerr by using intarnal table and then use this logiknr to check entry in table eastl. but i want those equnr which are in internal table but not mapped in eastl.
    I want the most efficient solution for this as there are many records.
    Thanks..... and if you have any queries then let me know.
    Jignesh.

    hi,
    as per ur statement, u want the field equnr which exists in the internal table but not in eastl. now for comparing with eastl u will need to check for all the three fields as they form the key...
    get data from egerr for matching equnr and bis in your internal table
    i.e. assuming ur table is itab  and itab_logiknr contains a single field logiknr
    select logiknr from egerr
      into table itab_logiknr
      for all entries in itab
      where equnr eq itab-equnr
        and bis eq itab-bis.
    now from this data (itab_egerr), compare the data with that in eastl for matching (or non matching) values of logiknr
    assuming data from eastl lies in itab_eastl
    select anlage bis logiknr from eastl into itab_eastl
    for all entries in itab_logiknr
    where logiknr eq itab_logiknr-logiknr.
    for non matching entries u can select data from eastl which is not present in itab_eastl now....
    (but mind you....since all fields of eastl form the key, u might not be getting the correct data) so if possible study ur scenario again and see if u can search the eastl table comparing all fields in the primary key)
    try this....get back in case of any clarifications
    hope it gives u some pointers...
    regards,
    PJ

  • Problem creating an sql query with a parameter which is a list

    Hi,
    Im having a problem creating a certain SQL query.
    The query looks like this:
    SELECT gstock_id FROM germplasm_stock gps, germplasm gp WHERE gps.germplasm_id = gp.germplasm_id AND organism_id IN ($childList:VARCHAR).
    the organism_id field is of DECIMAL type.
    the parameter childList is actually a list of Id's, something like: 123,124,789
    and it is created dynamically by an other function, so I cant just put it there staticlly.
    I tried using the ARRAY type instead of VARCHAR, but that didn't work,
    anyone knows how can I give this query a parameter which is a list of numbers ?
    Thanks

    I have tried all the following options and the same issue occurs:
    EXEC dbo.uspGetSiteChanges @ChangeVersion = ?
    With Parameter: 0, @ChangeVersion, ChangeVersion
    EXEC dbo.uspGetSiteChanges ?
    With Parameter: 0, @ChangeVersion, ChangeVersion
    In my first data flow I use the following and it works on two OLE DB Sources:
    EXEC dbo.uspGetSiteChanges @ChangeVersion = ?
    With:
    In my second data flow task, I use the same command and parameter mappings and it fails, very strange.

  • Long running sql query

    All,
    I'm new for sql query tuning. My select sql query is running more than 5-6 hours to complete and it is using bind variable. I'm using OEM to monitor the query. I can see stats are upto date and no blocking sessions and no object locks in db level. Can anyone guide me where I have to look and what should be done to increase the performance?
    Thanks.

    Read FAQ: {message:id=9360003}
    And {message:id=9360002}

  • Help me Please ..... How to Run SQL Query in Creator

    Hi all , I want to Run a SQL query in Creator how do i do it.
    If i want to retrive a set of records based on few matching fields or some join conditions , what method i can use ?
    How Can i run other SQL statements like ALTER , UPDATE , DROP ....
    Please Help me .

    Hi Hanumesh,
    To run SQL commands like ALTER, UPDATE, DROP you will have to go to the Pointbase console. Creator does not provide for database operations on the tables other than querying for data. To start the Pointbase console run startconsole.exe which can be found in <install directory>\SunAppServer8\pointbase\tools\serveroption.
    Hope this helps
    Cheers
    Girish

  • Running sql query across multiple (remote) databases

    I'd like to run a query that pulls information from multiple databases which are not on the same machine. Is this possible using SQL Developer?

    If you are still interested, there is a tool that can query multiple databases and save results in a single text file that you can then modify as necessary - see www.bsutils.com/MuSQL.html

  • Problem for running Update query with Chinese

    Hi all,
    I am running a web application in Lotus Domino.
    I have a Lotus Script Agent which need to update Oracle 8i Database with Chinese Character throught ODBC but i find that all characters become some strange characters.
    I got the problem only for update query.
    I have no problem for select query for getting the chinese data.
    Also, I got no problem to run the update query with chinese characters in Sqlplus.
    I also try to run the same update query which the ODBC connection is pointing to an MS Access Database. It works too.
    So the only things i leave is the Oracle ODBC driver.
    Anythings I should do for the Oracle ODBC server?
    Thanks very much.

    Hi, I checked the registry of Oracle and
    in the NLS_LANG field, the values is AMERICAN_AMERICA.UTF8. In the server side, I set the same.
    It should be okay, as i can retrieve the chinese content in the Oracle. Just that when i try to run a query contain chinese, such as,
    "insert into TableA values ('���')". i will got some strange character inserted in the databasae.
    Could you tell me what should i do?
    Thanks a lot a lot.

Maybe you are looking for