Can normal sql statement check thru all occurance ?

Hi ,
i have the following sample data
A)
select * from tt_test11 ;
        IDX1     CREATION_DATE
1     1     12/4/2006 11:00:23 AM
2     1     12/1/2006 11:00:23 AM
3     1     11/1/2006 11:00:23 AM
B)
select * from tt_test12
        IDX1     STARTTIME     ENDTIME
1     1     12/4/2006 10:00:23 AM     12/5/2006 1:00:23 AM
2     1     12/1/2006 10:00:23 AM     12/3/2006 1:00:23 AM
3     1     11/1/2006 10:00:23 AM     11/5/2006 1:00:23 AM
C)
select  * from tt_test11 a
where exists (select null from tt_test12 b
where a.idx1 = b.idx1
and a.creation_date not between b.starttime and b.endtime )
        IDX1     CREATION_DATE
1     1     12/4/2006 11:00:23 AM
2     1     12/1/2006 11:00:23 AM
3     1     11/1/2006 11:00:23 AMwhat i want to acheive :
i want to return all records from tt_test11 only when all records has been matched and there's no record that exists in the range from tt_test12
if seems that from part C , that it'll return a record as long as record from tt_test11 is not matched against a record in tt_test12
and i am now doing a function to check against all record in tt_test12 and return a flag to indicate whether the record from tt_test11 does not exist in tt_test12
but how can i do that in using SQL statements alone ?
pls advise
tks & rgds

I hope i have got your requirement right now. Is this what you want?
SQL> create table tt_test11
  2  as
  3  (select 1 IDX1,to_date('12/4/2006 11:00:23 AM','dd/mm/yyyy hh:mi:ss AM') CREATION_DATE from dual
  4  union all
  5  select 1,to_date('12/1/2006 11:00:23 AM','dd/mm/yyyy hh:mi:ss AM') from dual
  6  union all
  7  select 1,to_date('11/12/2006 11:00:23 AM','dd/mm/yyyy hh:mi:ss AM') from dual
  8  )
  9  /
Table created.
SQL> create table tt_test12
  2  as
  3  (
  4  select 1 IDX1,to_date('12/4/2006 10:00:23','dd/mm/yyyy hh:mi:ss') STARTTIME,to_date('12/5/2006 1:00:23 AM','dd/mm/yyyy hh:mi:ss AM') ENDTIME
from dual
  5  union all
  6  select 1,to_date('12/1/2006 10:00:23 AM','dd/mm/yyyy hh:mi:ss AM'),to_date('12/3/2006 1:00:23 AM','dd/mm/yyyy hh:mi:ss AM')  from dual
  7  union all
  8  select 1,to_date('11/1/2006 10:00:23 AM','dd/mm/yyyy hh:mi:ss AM'),to_date('11/5/2006 1:00:23 AM','dd/mm/yyyy hh:mi:ss AM')  from dual
  9  )
10  /
Table created.
SQL> alter session set nls_date_format='dd/mm/yyyy hh:mi:ss AM'
  2  /
Session altered.
SQL> select * from tt_test11
  2  /
      IDX1 CREATION_DATE
         1 12/04/2006 11:00:23 AM
         1 12/01/2006 11:00:23 AM
         1 11/12/2006 11:00:23 AM
SQL> select * from tt_test12
  2  /
      IDX1 STARTTIME              ENDTIME
         1 12/04/2006 10:00:23 AM 12/05/2006 01:00:23 AM
         1 12/01/2006 10:00:23 AM 12/03/2006 01:00:23 AM
         1 11/01/2006 10:00:23 AM 11/05/2006 01:00:23 AM
SQL> select distinct idx1,CREATION_DATE
  2  from
  3  (
  4  select a.idx1,b.CREATION_DATE,a.STARTTIME,a.endtime,
  5         sum(case when b.CREATION_DATE between a.STARTTIME and a.endtime then 1 else 0 end )
  6         over(partition by a.idx1,b.CREATION_DATE) flag
  7  from tt_test12 a,tt_test11 b
  8  where a.idx1=b.idx1
  9  )
10  where flag=0
11  /
      IDX1 CREATION_DATE
         1 11/12/2006 11:00:23 AMMessage was edited by:
Mohana

Similar Messages

  • 'lag' works in normal SQL statement, but not when in a view (resolved)

    hi,
    got a problem when using 'lag' in a view.
    if i set up a select statement using 'lag' and execute it, all the results are correct.
    when i stick the exact same select into a view, then the results for the 'lag' entries are not correct any more.
    has anyone experienced this ?
    any hints would be good.
    thanks
    Martin
    using Oracle 10g Express
    version 10.2.0.1.0
    can not download the patch because i can not log into metalink - no CSI
    setting to resolved.
    Message was edited by:
    user614086

    Hi again,
    I think the problem is more with your expectation of what LAG should be doing than with LAG itself.
    LAG must calculate based on the result set, in your stand alone query that means what's left after the WHERE clause is applied.
    In the view that means across all rows the view produces. THEN you apply the where clause to the calculated values. You can see this in the example below.
    So what you'd need to do is define this view in a manner in which the WHERE clause won't make a difference to the logical window produced.
    That would mean using some columns in the partition by clause and order by clause, or leaving the lag function outside the view.
    create table test_lag (column1 number, column2 varchar2(10), column3 date);
    insert into test_lag values (1, 'ONE', trunc(sysdate,'DD') - 1);
    insert into test_lag values (2, 'TWO' trunc(sysdate,'DD') );
    insert into test_lag values (3, 'THREE', trunc(sysdate,'DD') + 1);
    insert into test_lag values (4, 'FOUR', trunc(sysdate,'DD') + 2);
    commit;
    create or replace view test_lag_v
    as
    select column1, column2, lag(column2, 1) over (order by column1 asc) AS laggery, lag(column1) over (order by column3 desc) as laggery_2
    from test_lag;
    ME_XE?select *
      2  from test_lag_v
      3  where column1 <> 3;
               COLUMN1 COLUMN2                        LAGGERY                                 LAGGERY_2
                     4 FOUR                           THREE
                     1 ONE                                                                            3
    2 rows selected.
    Elapsed: 00:00:00.50
    ME_XE?
    ME_XE?select *
      2  from test_lag_v;
               COLUMN1 COLUMN2                        LAGGERY                                 LAGGERY_2
                     4 FOUR                           THREE
                     3 THREE                          ONE                                             4
                     1 ONE                                                                            3
    3 rows selected.
    Elapsed: 00:00:00.68

  • User can Execute SQL Statement but not Stored Procedure

    I have a function in Access that calls a stored procedure to update a table. When I run it, it works fine but when the users try to run it, they get an error.
    If I change it run the actual SQL syntax that is in the stored procedure then the users can run it and update the table without any problems, which makes no sense to me. It's doing the same exact thing as the stored procedure. I'd much rather have them be
    able to run the procedures then writing the SQL in VBA modules because that's going to end up being a lot of code.
    Any idea on why it's like this and how to correct it? Any assistance would be appreciated.

    Hello,
    When you give a user permission to run a stored procedure, everything on that procedure but Dynamic SQL will be executed
    without evaluating user permissions on the objects the stored procedure deals with.
    On the link I provided above, you will see how to provide permissions to stored procedures. Try creating database roles, add user to database roles, then assign permissions to database roles.
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • Missing semicolon (;) at end of SQL statement

    I'm getting this error on a form in which I'm trying to upload multiple files as well as populate a database with information about them all in one query. In addition, not every file field will be used every time the form is submitted, so I have some <cfif> tags to prevent errors in the event the fields are empty. I was able to get the form to work with only two file fields (leaving the second one blank to check that there would be no errors with blank fields), but when I expanded it to the full 15 (and all I did is copy and paste the code and update the field numbers), I get this error:
    Error Executing Database Query.
    Missing semicolon (;) at end of SQL statement.
    The error occurred in C:\ColdFusion9\wwwroot\CrimsonTideBand\admin\upload.cfm: line 477
    Called from C:\ColdFusion9\wwwroot\CrimsonTideBand\admin\upload.cfm: line 14
    Called from C:\ColdFusion9\wwwroot\CrimsonTideBand\admin\upload.cfm: line 1
    Called from C:\ColdFusion9\wwwroot\CrimsonTideBand\admin\upload.cfm: line 477
    Called from C:\ColdFusion9\wwwroot\CrimsonTideBand\admin\upload.cfm: line 14
    Called from C:\ColdFusion9\wwwroot\CrimsonTideBand\admin\upload.cfm: line 1
    475:  </cfif>)
    476:  </cfif>
    477:  <cfif IsDefined("FORM.File15") AND #FORM.File15# NEQ "">,
    478:  (<cfif IsDefined("FORM.Ensemble") AND #FORM.Ensemble# NEQ "">
    479:  <cfqueryparam value="#FORM.Ensemble# cfsqltype="cf_sql_clob" maxlength="255">
    Here is my full SQL for this query. Any help would be greatly appreciated. Also, if there's a more streamlined way to handle this sort of situation, that would be great as well. (Sorry, it's pretty long, but most of it is repetitive):
    <cfset CurrentPage=GetFileFromPath(GetBaseTemplatePath())>
    <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "upload">
      <cfquery datasource="ctband">
        INSERT INTO Files (Ensemble, Category, Selection, Part, File_Name, Uploaded_By)
        VALUES (<cfif IsDefined("FORM.Ensemble") AND #FORM.Ensemble# NEQ "">
        <cfqueryparam value="#FORM.Ensemble#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Category") AND #FORM.Category# NEQ "">
        <cfqueryparam value="#FORM.Category#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Selection") AND #FORM.Selection# NEQ "">
        <cfqueryparam value="#FORM.Selection#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Part1") AND #FORM.Part1# NEQ "">
        <cfqueryparam value="#FORM.Part1#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.File1") AND #FORM.File_Name1# NEQ "">
        <cfqueryparam value="#FORM.File_Name1#" cfsqltype="cf_sql_clob" maxlength="255">
        <cffile action="upload" filefield="File1" destination="C:\Coldfusion9\wwwroot\CrimsonTideBand\#FORM.Ensemble#\member_files" nameconflict="overwrite">
        <cfelse>
        </cfif>
        , <cfif IsDefined("SESSION.MM_Username") AND #SESSION.MM_Username# NEQ "">
        <cfqueryparam value="#SESSION.MM_Username#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>)
        <cfif IsDefined("FORM.File2") AND #FORM.File2# NEQ "">,
        (<cfif IsDefined("FORM.Ensemble") AND #FORM.Ensemble# NEQ "">
        <cfqueryparam value="#FORM.Ensemble#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Category") AND #FORM.Category# NEQ "">
        <cfqueryparam value="#FORM.Category#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Selection") AND #FORM.Selection# NEQ "">
        <cfqueryparam value="#FORM.Selection#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Part2") AND #FORM.Part2# NEQ "">
        <cfqueryparam value="#FORM.Part2#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.File2") AND #FORM.File_Name2# NEQ "">
        <cfqueryparam value="#FORM.File_Name2#" cfsqltype="cf_sql_clob" maxlength="255">
        <cffile action="upload" filefield="File2" destination="C:\Coldfusion9\wwwroot\CrimsonTideBand\#FORM.Ensemble#\member_files" nameconflict="overwrite">
        <cfelse>
        </cfif>
        , <cfif IsDefined("SESSION.MM_Username") AND #SESSION.MM_Username# NEQ "">
        <cfqueryparam value="#SESSION.MM_Username#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>)
        </cfif>
        <cfif IsDefined("FORM.File3") AND #FORM.File3# NEQ "">,
        (<cfif IsDefined("FORM.Ensemble") AND #FORM.Ensemble# NEQ "">
        <cfqueryparam value="#FORM.Ensemble#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Category") AND #FORM.Category# NEQ "">
        <cfqueryparam value="#FORM.Category#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Selection") AND #FORM.Selection# NEQ "">
        <cfqueryparam value="#FORM.Selection#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Part3") AND #FORM.Part3# NEQ "">
        <cfqueryparam value="#FORM.Part3#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.File3") AND #FORM.File_Name3# NEQ "">
        <cfqueryparam value="#FORM.File_Name3#" cfsqltype="cf_sql_clob" maxlength="255">
        <cffile action="upload" filefield="File3" destination="C:\Coldfusion9\wwwroot\CrimsonTideBand\#FORM.Ensemble#\member_files" nameconflict="overwrite">
        <cfelse>
        </cfif>
        , <cfif IsDefined("SESSION.MM_Username") AND #SESSION.MM_Username# NEQ "">
        <cfqueryparam value="#SESSION.MM_Username#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>)
        </cfif>
        <cfif IsDefined("FORM.File4") AND #FORM.File4# NEQ "">,
        (<cfif IsDefined("FORM.Ensemble") AND #FORM.Ensemble# NEQ "">
        <cfqueryparam value="#FORM.Ensemble#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Category") AND #FORM.Category# NEQ "">
        <cfqueryparam value="#FORM.Category#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Selection") AND #FORM.Selection# NEQ "">
        <cfqueryparam value="#FORM.Selection#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Part4") AND #FORM.Part4# NEQ "">
        <cfqueryparam value="#FORM.Part4#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.File4") AND #FORM.File_Name4# NEQ "">
        <cfqueryparam value="#FORM.File_Name4#" cfsqltype="cf_sql_clob" maxlength="255">
        <cffile action="upload" filefield="File4" destination="C:\Coldfusion9\wwwroot\CrimsonTideBand\#FORM.Ensemble#\member_files" nameconflict="overwrite">
        <cfelse>
        </cfif>
        , <cfif IsDefined("SESSION.MM_Username") AND #SESSION.MM_Username# NEQ "">
        <cfqueryparam value="#SESSION.MM_Username#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>)
        </cfif>
        <cfif IsDefined("FORM.File5") AND #FORM.File5# NEQ "">,
        (<cfif IsDefined("FORM.Ensemble") AND #FORM.Ensemble# NEQ "">
        <cfqueryparam value="#FORM.Ensemble#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Category") AND #FORM.Category# NEQ "">
        <cfqueryparam value="#FORM.Category#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Selection") AND #FORM.Selection# NEQ "">
        <cfqueryparam value="#FORM.Selection#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Part5") AND #FORM.Part5# NEQ "">
        <cfqueryparam value="#FORM.Part5#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.File5") AND #FORM.File_Name5# NEQ "">
        <cfqueryparam value="#FORM.File_Name5#" cfsqltype="cf_sql_clob" maxlength="255">
        <cffile action="upload" filefield="File5" destination="C:\Coldfusion9\wwwroot\CrimsonTideBand\#FORM.Ensemble#\member_files" nameconflict="overwrite">
        <cfelse>
        </cfif>
        , <cfif IsDefined("SESSION.MM_Username") AND #SESSION.MM_Username# NEQ "">
        <cfqueryparam value="#SESSION.MM_Username#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>)
        </cfif>
        <cfif IsDefined("FORM.File6") AND #FORM.File6# NEQ "">,
        (<cfif IsDefined("FORM.Ensemble") AND #FORM.Ensemble# NEQ "">
        <cfqueryparam value="#FORM.Ensemble#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Category") AND #FORM.Category# NEQ "">
        <cfqueryparam value="#FORM.Category#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Selection") AND #FORM.Selection# NEQ "">
        <cfqueryparam value="#FORM.Selection#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Part6") AND #FORM.Part6# NEQ "">
        <cfqueryparam value="#FORM.Part6#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.File6") AND #FORM.File_Name6# NEQ "">
        <cfqueryparam value="#FORM.File_Name6#" cfsqltype="cf_sql_clob" maxlength="255">
        <cffile action="upload" filefield="File6" destination="C:\Coldfusion9\wwwroot\CrimsonTideBand\#FORM.Ensemble#\member_files" nameconflict="overwrite">
        <cfelse>
        </cfif>
        , <cfif IsDefined("SESSION.MM_Username") AND #SESSION.MM_Username# NEQ "">
        <cfqueryparam value="#SESSION.MM_Username#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>)
        </cfif>
        <cfif IsDefined("FORM.File7") AND #FORM.File7# NEQ "">,
        (<cfif IsDefined("FORM.Ensemble") AND #FORM.Ensemble# NEQ "">
        <cfqueryparam value="#FORM.Ensemble#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Category") AND #FORM.Category# NEQ "">
        <cfqueryparam value="#FORM.Category#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Selection") AND #FORM.Selection# NEQ "">
        <cfqueryparam value="#FORM.Selection#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Part7") AND #FORM.Part7# NEQ "">
        <cfqueryparam value="#FORM.Part7#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.File7") AND #FORM.File_Name7# NEQ "">
        <cfqueryparam value="#FORM.File_Name7#" cfsqltype="cf_sql_clob" maxlength="255">
        <cffile action="upload" filefield="File7" destination="C:\Coldfusion9\wwwroot\CrimsonTideBand\#FORM.Ensemble#\member_files" nameconflict="overwrite">
        <cfelse>
        </cfif>
        , <cfif IsDefined("SESSION.MM_Username") AND #SESSION.MM_Username# NEQ "">
        <cfqueryparam value="#SESSION.MM_Username#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>)
        </cfif>
        <cfif IsDefined("FORM.File8") AND #FORM.File8# NEQ "">,
        (<cfif IsDefined("FORM.Ensemble") AND #FORM.Ensemble# NEQ "">
        <cfqueryparam value="#FORM.Ensemble#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Category") AND #FORM.Category# NEQ "">
        <cfqueryparam value="#FORM.Category#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Selection") AND #FORM.Selection# NEQ "">
        <cfqueryparam value="#FORM.Selection#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Part8") AND #FORM.Part8# NEQ "">
        <cfqueryparam value="#FORM.Part8#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.File8") AND #FORM.File_Name8# NEQ "">
        <cfqueryparam value="#FORM.File_Name8#" cfsqltype="cf_sql_clob" maxlength="255">
        <cffile action="upload" filefield="File8" destination="C:\Coldfusion9\wwwroot\CrimsonTideBand\#FORM.Ensemble#\member_files" nameconflict="overwrite">
        <cfelse>
        </cfif>
        , <cfif IsDefined("SESSION.MM_Username") AND #SESSION.MM_Username# NEQ "">
        <cfqueryparam value="#SESSION.MM_Username#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>)
        </cfif>
        <cfif IsDefined("FORM.File9") AND #FORM.File9# NEQ "">,
        (<cfif IsDefined("FORM.Ensemble") AND #FORM.Ensemble# NEQ "">
        <cfqueryparam value="#FORM.Ensemble#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Category") AND #FORM.Category# NEQ "">
        <cfqueryparam value="#FORM.Category#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Selection") AND #FORM.Selection# NEQ "">
        <cfqueryparam value="#FORM.Selection#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Part9") AND #FORM.Part9# NEQ "">
        <cfqueryparam value="#FORM.Part9#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.File9") AND #FORM.File_Name9# NEQ "">
        <cfqueryparam value="#FORM.File_Name9#" cfsqltype="cf_sql_clob" maxlength="255">
        <cffile action="upload" filefield="File9" destination="C:\Coldfusion9\wwwroot\CrimsonTideBand\#FORM.Ensemble#\member_files" nameconflict="overwrite">
        <cfelse>
        </cfif>
        , <cfif IsDefined("SESSION.MM_Username") AND #SESSION.MM_Username# NEQ "">
        <cfqueryparam value="#SESSION.MM_Username#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>)
        </cfif>
        <cfif IsDefined("FORM.File10") AND #FORM.File10# NEQ "">,
        (<cfif IsDefined("FORM.Ensemble") AND #FORM.Ensemble# NEQ "">
        <cfqueryparam value="#FORM.Ensemble#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Category") AND #FORM.Category# NEQ "">
        <cfqueryparam value="#FORM.Category#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Selection") AND #FORM.Selection# NEQ "">
        <cfqueryparam value="#FORM.Selection#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Part10") AND #FORM.Part10# NEQ "">
        <cfqueryparam value="#FORM.Part10#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.File10") AND #FORM.File_Name10# NEQ "">
        <cfqueryparam value="#FORM.File_Name10#" cfsqltype="cf_sql_clob" maxlength="255">
        <cffile action="upload" filefield="File10" destination="C:\Coldfusion9\wwwroot\CrimsonTideBand\#FORM.Ensemble#\member_files" nameconflict="overwrite">
        <cfelse>
        </cfif>
        , <cfif IsDefined("SESSION.MM_Username") AND #SESSION.MM_Username# NEQ "">
        <cfqueryparam value="#SESSION.MM_Username#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>)
        </cfif>
        <cfif IsDefined("FORM.File11") AND #FORM.File11# NEQ "">,
        (<cfif IsDefined("FORM.Ensemble") AND #FORM.Ensemble# NEQ "">
        <cfqueryparam value="#FORM.Ensemble#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Category") AND #FORM.Category# NEQ "">
        <cfqueryparam value="#FORM.Category#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Selection") AND #FORM.Selection# NEQ "">
        <cfqueryparam value="#FORM.Selection#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Part11") AND #FORM.Part11# NEQ "">
        <cfqueryparam value="#FORM.Part11#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.File11") AND #FORM.File_Name11# NEQ "">
        <cfqueryparam value="#FORM.File_Name11#" cfsqltype="cf_sql_clob" maxlength="255">
        <cffile action="upload" filefield="File11" destination="C:\Coldfusion9\wwwroot\CrimsonTideBand\#FORM.Ensemble#\member_files" nameconflict="overwrite">
        <cfelse>
        </cfif>
        , <cfif IsDefined("SESSION.MM_Username") AND #SESSION.MM_Username# NEQ "">
        <cfqueryparam value="#SESSION.MM_Username#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>)
        </cfif>
        <cfif IsDefined("FORM.File12") AND #FORM.File12# NEQ "">,
        (<cfif IsDefined("FORM.Ensemble") AND #FORM.Ensemble# NEQ "">
        <cfqueryparam value="#FORM.Ensemble#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Category") AND #FORM.Category# NEQ "">
        <cfqueryparam value="#FORM.Category#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Selection") AND #FORM.Selection# NEQ "">
        <cfqueryparam value="#FORM.Selection#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Part12") AND #FORM.Part12# NEQ "">
        <cfqueryparam value="#FORM.Part12#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.File12") AND #FORM.File_Name12# NEQ "">
        <cfqueryparam value="#FORM.File_Name12#" cfsqltype="cf_sql_clob" maxlength="255">
        <cffile action="upload" filefield="File12" destination="C:\Coldfusion9\wwwroot\CrimsonTideBand\#FORM.Ensemble#\member_files" nameconflict="overwrite">
        <cfelse>
        </cfif>
        , <cfif IsDefined("SESSION.MM_Username") AND #SESSION.MM_Username# NEQ "">
        <cfqueryparam value="#SESSION.MM_Username#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>)
        </cfif>
        <cfif IsDefined("FORM.File13") AND #FORM.File13# NEQ "">,
        (<cfif IsDefined("FORM.Ensemble") AND #FORM.Ensemble# NEQ "">
        <cfqueryparam value="#FORM.Ensemble#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Category") AND #FORM.Category# NEQ "">
        <cfqueryparam value="#FORM.Category#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Selection") AND #FORM.Selection# NEQ "">
        <cfqueryparam value="#FORM.Selection#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Part13") AND #FORM.Part13# NEQ "">
        <cfqueryparam value="#FORM.Part13#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.File13") AND #FORM.File_Name13# NEQ "">
        <cfqueryparam value="#FORM.File_Name13#" cfsqltype="cf_sql_clob" maxlength="255">
        <cffile action="upload" filefield="File13" destination="C:\Coldfusion9\wwwroot\CrimsonTideBand\#FORM.Ensemble#\member_files" nameconflict="overwrite">
        <cfelse>
        </cfif>
        , <cfif IsDefined("SESSION.MM_Username") AND #SESSION.MM_Username# NEQ "">
        <cfqueryparam value="#SESSION.MM_Username#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>)
        </cfif>
        <cfif IsDefined("FORM.File14") AND #FORM.File14# NEQ "">,
        (<cfif IsDefined("FORM.Ensemble") AND #FORM.Ensemble# NEQ "">
        <cfqueryparam value="#FORM.Ensemble#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Category") AND #FORM.Category# NEQ "">
        <cfqueryparam value="#FORM.Category#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Selection") AND #FORM.Selection# NEQ "">
        <cfqueryparam value="#FORM.Selection#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Part14") AND #FORM.Part14# NEQ "">
        <cfqueryparam value="#FORM.Part14#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.File14") AND #FORM.File_Name14# NEQ "">
        <cfqueryparam value="#FORM.File_Name14#" cfsqltype="cf_sql_clob" maxlength="255">
        <cffile action="upload" filefield="File14" destination="C:\Coldfusion9\wwwroot\CrimsonTideBand\#FORM.Ensemble#\member_files" nameconflict="overwrite">
        <cfelse>
        </cfif>
        , <cfif IsDefined("SESSION.MM_Username") AND #SESSION.MM_Username# NEQ "">
        <cfqueryparam value="#SESSION.MM_Username#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>)
        </cfif>
        <cfif IsDefined("FORM.File15") AND #FORM.File15# NEQ "">,
        (<cfif IsDefined("FORM.Ensemble") AND #FORM.Ensemble# NEQ "">
        <cfqueryparam value="#FORM.Ensemble#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Category") AND #FORM.Category# NEQ "">
        <cfqueryparam value="#FORM.Category#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Selection") AND #FORM.Selection# NEQ "">
        <cfqueryparam value="#FORM.Selection#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.Part15") AND #FORM.Part15# NEQ "">
        <cfqueryparam value="#FORM.Part15#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>
        , <cfif IsDefined("FORM.File15") AND #FORM.File_Name15# NEQ "">
        <cfqueryparam value="#FORM.File_Name15#" cfsqltype="cf_sql_clob" maxlength="255">
        <cffile action="upload" filefield="File15" destination="C:\Coldfusion9\wwwroot\CrimsonTideBand\#FORM.Ensemble#\member_files" nameconflict="overwrite">
        <cfelse>
        </cfif>
        , <cfif IsDefined("SESSION.MM_Username") AND #SESSION.MM_Username# NEQ "">
        <cfqueryparam value="#SESSION.MM_Username#" cfsqltype="cf_sql_clob" maxlength="255">
        <cfelse>
        </cfif>)
        </cfif>
      </cfquery>
      <cflocation url="/admin/upload_confirm.cfm">
    </cfif>

    Okay, I've rewritten the page and sql using loops. The problem I have is that if I don't use all the file fields, I get the error message:
    The form field File2 did not contain a file.
    (substitute whatever file field is the first empty one).
    What I tried to do was insert <cfif> tags to overlook the blank entries. Here's my new SQL:
    <cfif IsDefined ("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "upload">
      <cfloop from="1" to="15" index="counter">
        <cfset CurrentPart="FORM.Part#counter#">
        <cfif #CurrentPart# NEQ "">
          <cffile action="upload" filefield="File#counter#" destination="C:\Coldfusion9\wwwroot\CrimsonTideBand\#FORM.Ensemble#\member_files" nameconflict="overwrite">
          <cfquery datasource="ctband">
            INSERT INTO Files (Ensemble, Category, Selection, File_Name, Part, Uploaded_By)
            VALUES (<cfqueryparam value="#FORM.Ensemble#" cfsqltype="cf_sql_varchar">,
                    <cfqueryparam value="#FORM.Category#" cfsqltype="cf_sql_varchar">,
                    <cfqueryparam value="#FORM.Selection#" cfsqltype="cf_sql_varchar">,
                    "#CFFILE.serverFile#",
                    <cfqueryparam value="#CurrentPart#" cfsqltype="cf_sql_varchar">,
                    <cfqueryparam value="#SESSION.MM_Username#" cfsqltype="cf_sql_varchar">)
          </cfquery>
        </cfif>
      </cfloop>
    </cfif>
    Any thoughts on how to get it to overlook the unused file fields, or stop the loop at the last populated field?
    Thanks for your help!

  • Using SQL Statements in Error Exceptions

    Is there any way to include SQL statements within my catch routines (i.e.
    catch (java.io.IOException ex) {
    System.out.println("An error occurred whilst writing to the message buffer: " + ex);
    #sql { INSERT INTO DEBUG_TBL(CURRENT_DT,PROGRAM_ID,DEBUG__MESG) VALUES (SYSDATE,'TEST',:ex) };
    #sql { COMMIT };
    As it stands I get the following error upon compile:
    Error: Unsupported Java type for host item (at position#1): java.io.IOException
    Any help would be greatly appreciated.
    Thx,
    Boybles
    null

    You can use SQL statements in your catch blocks, just not SQL statements that use Java types which do not map to SQL.
    You cannot pass exceptions from Java to SQL. You can catch a SQL exceptions as a SQLException in Java. However, any exception that is thrown by a Java Stored Procedure (including SQLException) is rendered as an "Uncaught Java exception" in SQL.
    When you receive a SQLException there is information about the originator, the error message, etc. in the exception object. See:
    http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/java.817/a83723/keyprog5.htm#1004462
    While you cannot insert a Java exception per se into a table, you can extract the message string(s)/code and insert that in a table.

  • Re entering sql statements in sql plus

    Hi,
    How to enter and can edit sql statements in sqlplus without re typing sql statements which were previously executed.

    Hi,
    ravi02 wrote:
    Hi,
    How to enter and can edit sql statements in sqlplus without re typing sql statements which were previously executed.Depending on your OS and your version of SQL*Plus, you can recall past SQL*Plus commands the same way you recall past OS commands. On my Windows system, I press the up-arrow key to get old SQL*Plus commands. Then I can press ENTER to run the command verbatim, or I can type over the command (using back-arrow, backspace and delete keys, if I want) to change the command before pressing ENTER.
    That's only good for single-line commands. If you have a statement that needs more than 1 line, type it in a file using any text editor, and the use the SQL*Plus @ command to run it.
    For example, if my SQL statements are saved in file called my_script.sql, which is on the foo\bar folder of the d: drive, I can say
    @d:\foo\bar\my_scriptto run all the commands in the file.
    Depending on your OS, you can do somehting similar.

  • Sql statement from UI

    Hi,
    I am new to EBS and it's ui.
    I would need to fire sql statements on the database.
    Is there a interface in EBS from which i can fire sql statements ?
    thanks,
    ravi.

    Hi,
    I would need to fire sql statements on the database. Use database triggers -- See this thread for a similar discussion.
    Can I write custom databse Trigger over a apps table.
    Can I write custom databse Trigger over a apps table.
    You could also use Oracle Alert -- You can find the user guide at http://www.oracle.com/technology/documentation/applications.html
    Is there a interface in EBS from which i can fire sql statements ?All Oracle APIs can be used at [Oracle Integration Repository  |http://irep.oracle.com/] website, I am not aware of any API which can be used to fire any SQL statements (I believe such an API does not exists), but you could browse the categories and see if any helps.
    Regards,
    Hussein

  • Error in the sql statement for SQL Server

    Hy:)
    i am using this sql statement to get all fields, which have been changed since yesterday
    SELECT ITEMCODE FROM SBODemo_UK.DBO.OITM  WHERE CREATEDATE IS >= DATEADD(day, -1, GetDate())
    But its not working.. you have any suggestions?
    cheers,
    Maggie

    Hello Margarete,
    I think ur query works if u simply remove 'IS' from it
    SELECT ITEMCODE FROM SBODemo_India.DBO.OITM
    WHERE CREATEDATE >= DATEADD(day, -1, GetDate())
    Manu

  • What does 'security setup forms that accept sql statement' mean?

    I was referring one white paper 'Best Practices for Securing Oracle E-Business Suite'.
    I would like to know what does 'security setup forms that accept sql statement' mean in that?
    My question is
    Where can the SQL statements be entered?
    It would be better if I can have some examples of the same. I am trying to understand this statement.
    Edited by: Kavipriya on 30 Mar, 2011 3:37 PM

    It is explained in the same docs.
    Best Practices for Securing the E-Business Suite [ID 189367.1] -- Page 26, under "LIMIT ACCESS TO FORMS ALLOWING SQL ENTRY" section.
    Best Practices For Securing Oracle E-Business Suite Release 12 [ID 403537.1] -- Page 22, under "LIMIT ACCESS TO FORMS ALLOWING SQL ENTRY" section.
    Thanks,
    Hussein

  • Create this SQL statement

    Hi
    Please can you help me to create this SQL statement ?
    I have two tables: table1 consist of data (AAA,BBB), table2 consist of data(AAA)
    And there is relation between table1 and table2 for example (Invoice_id) .
    My question is ( How can create SQL statement to display only data in table1(BBB) but not available In table2 ?
    Thanks and best regards .
    Khaled

    Try this:
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 'AAA' col1,1 inv_id from dual
      2  UNION select 'BBB',1 from dual)
      3  , s as (select 'AAA' col1,1 inv_id from dual)
      4  SELECT col1,inv_id FROM t
      5* WHERE NOT EXISTS (SELECT 1 FROM s WHERE inv_id = t.inv_id AND col1 = t.col1)
    SQL> /
    COL     INV_ID
    BBB          1
    SQL>

  • How can I write a SQL statement which checks if a table exists?

    How can I write a SQL statement which tells me whether a table exists?

    execute an sql query: select * from <tablename>
    catch the exception n check whether the erroe code
    matches the one that occurs for table doesn't exist
    that's itHow is your answer any different from the one given in the first reply?
    It isn't.
    As WorkForFood says DatabaseMetaData has a bunch of methods for getting information about tables but this is more useful when you don't know the names of any of the tables.. it sounds like you do so I would concur SELECT from table is probably the quickest way to go. If it helps the Xopen error should be either S1000 or 42S01 (I think) but I would try and see if there is a specific vendor code for table not found/not exists error and check for that.

  • Can I change sql statement for some query runtime?

    Hi All!
    The problem that I have to implement report with query like this: select * from a where b in (?,?,?). The number of parameters depends on user choice. On the client side it will be a list of check boxes. Is there any way to implement such report? I can see just one way so far - to modify sql statement runtime.
    Thanks!

    hello,
    create a user-parameter myListe or myWhere (wee examples below) and change your query to
    select ... from ... where b in (&<myList>)
    or even better
    select ... from ... &<myWhere>
    now you can pass in the constructed list or where clause. you can also construct the values in the afterParameterform-Trigger
    regards,
    philipp

  • How to see all sql statements on sql commands under history link

    Hi All,
    How to see the all the sql history on sql commands tab.
    I want see all sql statements.
    Where to set if we need to store more sql statments in history.
    We are using Apex3.2 and 10g database(EE).
    Thanks,
    Nr

    I just checked the source code of the SQL commands history region and that report fetches a maximum of 1000 records. I don't know if you change the setting somewhere in the builder, but seeing the code it looks as though 1000 is hard-coded in the report definition(apex 4.0).
    If you need to see all the command history,you can query the original table: APEX_040000.WWV_FLOW_SW_SQL_CMDS
    Note that is an internal table used by apex and hence you might not find any documentation about it(google got me one valid hit: Identifying Inactive Workspaces which seem to confirm the table's use).
    Anyway, here's what you need to do, ask your dba to grant your workspace user select access on this table
    Connect as dba user and run
    GRANT SELECT ON APEX_040000.wwv_flow_sw_sql_cmds to '<WORKSPACE SCHEMA>'Now you can run the following command from your workspace to see the entire command history using
    select * from APEX_040000.WWV_FLOW_SW_SQL_CMDS where parsed_schema = '<WORKSPACE SCHEMA>';You might want to revoke the grant once you have seen the data/taken out an export due to security issues.

  • Check SQL statement in BI

    Hi all.
    I've wrote some SQL statement against charcteristic Master Data table in Transfer Routine to get the result for attribute value. It seems to me my SQL statement doesn't work. Is where any transation/tool in BI to run/check SQL statements ?

    hi,
    you can always check the syntax after writing a routine.Also, you can put a break-point and debug to check the behavior of the code.
    Can u explain in more detail, what is the Statement that is giving problem?
    Regards,
    Srinivas Kamireddy.

  • Check the sql statement of view

    HI All
    I have a query that
    How can we check the SQL statement of any view in oracle 10.
    If any one knows then pls let me know

    SQL> select view_name,text from user_views where VIEW_NAME='HISTORY';
    VIEW_NAME
    TEXT
    HISTORY
    select
    Serial,
    0 State,
    Availablet At,
    AvailableD

Maybe you are looking for

  • Error in runing JDBC Test

    Hello Everobody I have installed jdk on my Solaris server. following is the paths CLASSPATH=/usr/local/jdbc/classes102.zip:/export/home/username:/usr/local/jdbc/classes111.zip LD_LIBRARY_PATH=/usr/local/jdbc PATH=$PATH:/usr/j2se/bin When I am running

  • IPhoto books disappeared before I could order!

    Our beloved cat died two nights ago, and my son and I have made two iPhoto books about his life. My son's book was done yesterday, so we ordered it, which went fine. Today I opened iPhoto to finish mine, and it was missing from "projects" as was my s

  • Re: Export Return

    HI Guru, i have purchase the material via import purchase. i found some of the material are defect. now i want to return that material via export to same vendor. in this flow excise part also exsiste. please give the details about the return flow for

  • IPhoto missing photo's. rebuild already done

    After the recent update of iphoto 9.3.1. I can't work on some photo's anymore. They do appear in the library as thumbnail but if you click on it an exclamation point in a triangle appears. Rebuild the library but the problem remains. It concerns phot

  • No internal speaker drive

    macbook pro os 10.6.8 all in sudden when I started up it asked me to restart because it has some problem. I restarted then this time no start up sound. speaker icon on right top is grey and I am unable to change anything. open the preference for inpu