Hide Partial Query Results

I need to get the results that display to a webpage from one of my pl/sql queries to hide certain characters, but only in certain conditions. The problem is, one of our vendors has been making the mistake of placing their customers social security numbers in the description field. Naturally, displaying the SS numbers for all to see is a bad thing. So until we can get them to fix what they are doing, I need to hide part of the description field, but only if it is including a SS#.
For example, this is what they are doing in that field:
123456789Smith, John
When it's only supposed to be:
Smith, John
Not displaying the entire field is not an option because we have tons of vendors who are doing it right and we can't take away the functionality entirely. I need a way to say, If voucher_description begins with 9 numbers, block out those numbers. But, I don't know how to do that. Does anyone know how to do this, or where I can look for an example of what I need?
The Cursor.....
CURSOR c1 IS
select fund, appropriation, voucher_amount, gl_account_number,
department, vendor_invoice, job_number, reference_number,
check_category, voucher_description, discount
from vend_vouch_check
where voucher_number = vd_vouch_in
and (vd_check_in = check_number or
vd_check_in = 'NONE');
Here is how voucher_description is displayed. Is this where I need to make the condition?
for c1_rec in c1 loop
htp.tableData(c1_rec.voucher_description);
end loop;
Any help would be much appreciated. Thanks!

To build on Volder's reply :
with t as (select '123234345John, Smith' str from dual union all
             select 'abc123456789John Smith' from dual union all
             select 'john smith 555-666-8888' from dual union all
             select '1 john smith' from dual union all
             select '123-45-6789 Josh smith' from dual union all
             select 'Josh 123-45-6789 Smith' from dual)
select
  str
  ,translate(str,' 1234567890',' ')
  ,regexp_replace(str,'[0-9]')
  ,regexp_replace(str,'[0-9]{9}')
  ,regexp_replace(str,'[0-9]{9}|[0-9]{3}-[0-9]{2}-[0-9]{4}')
from
  t
STR                     TRANSLATE(STR,'1234567890','') REGEXP_REPLACE(STR,'[0-9]') SSN_9CHAR               SSN_W_DASH             
123234345John, Smith    John, Smith                    John, Smith                 John, Smith             John, Smith            
abc123456789John Smith  abcJohn Smith                  abcJohn Smith               abcJohn Smith           abcJohn Smith          
john smith 555-666-8888 john smith --                  john smith --               john smith 555-666-8888 john smith 555-666-8888
1 john smith             john smith                     john smith                 1 john smith            1 john smith           
123-45-6789 Josh smith  -- Josh smith                  -- Josh smith               123-45-6789 Josh smith   Josh smith            
Josh 123-45-6789 Smith  Josh -- Smith                  Josh -- Smith               Josh 123-45-6789 Smith  Josh  Smith            
6 rows selectedThe last one matches both the 9 digit variety and the with dashes variety of SSN, while leaving other digits.
I did this with the info at http://www.regular-expressions.info/quickstart.html
Does anybody more familiar with regexp have any advice?

Similar Messages

  • How to get Query Results based on Analysis Authorization Ranges????

    Hi Experts,
    I have gone through the lot of SDN Links, however not able to find the answer to my question.
    I have an Authorization Issue, “NO Authorization “
    Error : EYE 007 ( Insufficient Authorizations )
    <b>Here is the issue:</b>
    Need to see the complete query result when I gave the range in Analysis Authorization for Controlling Area 001-005. Controlling Area is auth relevant and right now a variable is inserted in the query for it. If I select Controlling Area 001, the result for Controlling Area 001 is displayed in query. If 002 then also displayed. If I do not enter anything, then I get the <b>Eye 007 error message</b>.
    I am not sure how do I display/authorize the entire result in the query for all the Controlling Areas, I have authorized user to see??
    <b>Its really urgent, please help..!</b>
    Here are the logs:
    Authorization Check Log
    Date and Execution Time (Local Server)
    Execution Date: 06.09.2007
    Execution Time: 14:48:41
    Executed Query: 0CCA_C11/GBCCA_MP01_Q0002_AP
    Executed by User ZBI_TEST_001
    Executed with Analysis Authorizations of Another User ZBI_TEST_001
      InfoProvider Check  
    Building the Buffer...
    ...Buffer Built
    Are there authorizations for accessing InfoProvider 0CCA_C11 with activity 03?
    Authorization exists for general access to InfoProvider 0CCA_C11 with activity 03 
      InfoProvider Check  
    Authorization exists for general access to InfoProvider 0CCA_C11 with activity 03 
      Relevant Characteristics for Detailed Authorization Check  
    (Characteristics with Full Authorization Are Not Listed!)
      List of Effective Authorization-Relevant Characteristics for InfoProvider 0CCA_C11:  
    0CO_AREA 
    0TCAACTVT 
      Relevant Characteristics for Detailed Authorization Check  
    (Characteristics with Full Authorization Are Not Listed!)
      List of Effective Authorization-Relevant Characteristics for InfoProvider :  
    List Is Empty:
      There Are No Characteristics That Have to Be Checked in Detail  
      Authorization Check  
      Detail Check for InfoProvider 0CCA_C11  
      Preprocessing:  
    Selection Checked for Consistency, Preprocessed and Supplemented As Needed
    Subselection (Technical SUBNR) 1
    Check Node Definitions and Value Authorizations...
    Node- and Value Authorizations Are OK
    End of Preprocessing
    Filling the Buffer...
    ...Buffer Filled
      Main Check:  
      Subselection (Technical SUBNR) 1  
    Supplementation of Selection for Aggregated Characteristics
      No Check for Aggregation Authorization Required  
    Following Set Is Checked  Comparison with Following Authorized Set  Result  Remaining Set 
    Characteristic  Contents 
    0CO_AREA
    0TCAACTVT
    SQL Format:
    CO_AREA = '0003'
    AND TCAACTVT = '03'
    Characteristic  Contents 
    0CO_AREA  I BT 0001 0005
    0TCAACTVT  I EQ 03
    I EQ 16
    Authorized   
      Subselection (SUBNR) Is Authorized  
      Authorization Check Complete  
      Authorization Check  
      Detail Check for InfoProvider 0CCA_C11  
      Preprocessing:  
    Selection Checked for Consistency, Preprocessed and Supplemented As Needed
    Subselection (Technical SUBNR) 1
    Check Node Definitions and Value Authorizations...
    Node- and Value Authorizations Are OK
    End of Preprocessing
    Filling the Buffer...
    ...Buffer Filled
      Main Check:  
      Subselection (Technical SUBNR) 1  
    Supplementation of Selection for Aggregated Characteristics
      No Check for Aggregation Authorization Required  
    Following Set Is Checked  Comparison with Following Authorized Set  Result  Remaining Set 
    Characteristic  Contents 
    0CO_AREA
    0TCAACTVT
    SQL Format:
    TCAACTVT = '03'
    Characteristic  Contents 
    0CO_AREA  I BT 0001 0005
    0TCAACTVT  I EQ 03
    I EQ 16
    Partially or Fully Authorized (Intersection)   Characteristic  Contents 
    0CO_AREA
    0TCAACTVT
    SQL Format:
    ( CO_AREA < '0001'
    OR CO_AREA > '0005' )
    AND TCAACTVT = '03'
    Value selection partially authorized. Check of remainder at end
    Following Set Is Checked  Comparison with Following Authorized Set  Result  Remaining Set 
    Characteristic  Contents 
    0CO_AREA
    0TCAACTVT
    SQL Format:
    ( CO_AREA < '0001'
    OR CO_AREA > '0005' )
    AND TCAACTVT = '03'
    Characteristic  Contents 
    0CO_AREA  I BT 0001 0005
    0TCAACTVT  I EQ 03
    I EQ 16
    Not Authorized   
    All Authorizations Tested
      Message EYE007: You do not have sufficient authorization  
      No Sufficient Authorization for This Subselection (SUBNR)  
    Following CHANMIDs Are Affected:
    184 ( 0CO_AREA )
      Authorization Check Complete  

    Hi,
        Have you defined the vaule for 0CO_AREA as BT 001-005 in you Authorization for 0CO_AREA.Also how have you defined your Authorization Variable on the query? Have you define as select options or interval? I thing you need to define it as interval or select options.
    Hope it helps,
    Cheers,
    Balaji

  • How to hide the Save Results Layout checkbox on the Create Saved Search pop

    I need to hide the Save Results Layout checkbox on the Create Saved Search popup. Can anyone tell me how to do it?
    This popup is used when the user is on a query (rendered by the af:query component) and they select click the "Save..." button. The have three options, Set as Default, Run Automatically, and Save Results Layout. I have an implementation that supports everything except saving the layout. So I need to hide that checkbox.
    Thanks,
    Mike

    For anybody else who needs to do this, here is how I did it.
    Add this to your css
    /* This hides the Save Results Layout checkbox on the Create Saved Search screen */
    span[id$='saveLayout'] {
    visibility: hidden;
    }

  • Hiding SQL statement in Query Result Window

    Hi everyone,
    Is it possible to hide the SQL statement from a query result window? This can usually be done by click the orange triangle that is positioned to the left of the SQL string box (to expand and collapse it). The System Queries have this box collapsed per default, is it possible to have this setup as default for all queries, including the custom? If so, please let me know where this can be done.
    Cheers

    You should do this only with SDK programming - dont allow to show the syntax. The next, but problematic way, is the code you have do inside stored procedure and call only this sp inside the query generator window - if you have there some input parameters, you should use filling variables before executing sp and get it as input parameters to sp.

  • Create a CF Query Result Set in Java

    I'd like to programatically build a ColdFusion query resultset inside of a Java class and return it to the calling application.  See the Java psudocode below to see what I'm talking about:
    public class MyClass {
         public coldfusion.sql.QueryTable getQuery() {
              // Create a query table object
              QueryTable myTable = ..?
              // Loop through some set of instance data for my class
              for(int c = 0; c < this.myWigets.length; c++) {
                   int row = c+1;
                   myTable.setField(row, nameCol, this.myWigets[c].name);
                   myTable.setField(row, colorCol, this.myWigets[c].color);
              return myTable;
    I've had stuff like this partially working in the past but had issues with things like query of queries and such probably due to the hacks used to create the QueryTable object.  I'm mainly just checking in to see if there has been any progress made in this area.  To me this seems like such an obvious thing for a Java developer working within CF to want to do.  I'm surprised Adobe doesn't have an officially supported API for doing this sort of thing (or maybe I'm just too dumb to find it.)    A few other notes... I'm not using CFX, and I'm not starting with a java.sql.ResultSet otherwise I would use the QueryTable(java.sql.ResultSet) constructor.  I need to build this thing from scratch programatically.
    Thanks for your time.  I hope this question makes sense to someone out there.
    - Mike

    I appologize.  I wasn't very clear with my original question.
    I'm creating an instance of my Java class from within CF using createObject("java", "com.example.MyClass").  So based on the sample code in my original post on the CF side I'd like to do something like this:
    <cfscript>
         myObj = createObject("java", "com.example.MyClass");
         myObj.doSomeStuff();
         myCFQuery = myObj.getQuery();  // Return a CF query from my java class
    </cfscript>
    ... then do stuff like ...
    <cfquery name="mySortedQuery" dbtype="query">
         select     *
         from       myCFQuery
         order      by color
    </cfquery>
    I appriciate your suggestions so far.  I have other solutions working already but they are not ideal.  I was just hoping someone had a clean and as-hack-free-as-possible way of creating a ColdFusion query result set in Java and passing it back to CF.
    Thanks again,
    Mike

  • Query result closing prematurely, Object closed error

    Hi guys
    I've discovered an unusual behaviour when iterating through a collection
    returned from a query.
    Scenario
    The code executes a query, iterates partially through the resultset and for
    each row calls a method which creates another object. Given that there
    could be thousands of rows, I commit the new objects every n times and then
    go back to the start of the loop which re-executes the query. This code runs
    fine when
    MAX_SCHEDULES_PER_TRANS <= com.solarmetric.kodo.DefaultFetchBatchSize.
    Problem
    If the DefaultFetchBatchSize is 10, and I commit every 11 iterations, then
    during the 3rd outer loop (ie commit has succeeded twice and the query has
    been executed 3 times) an exception is thrown when calling events.next() on
    the 10th element. The stack trace is included below, but it appears that
    the query resultset is somehow being closed early.
    If I increase the DefaultFetchBatchSize to 20, then I can also increase my
    MAX_SCHEDULES_PER_TRANS to 20 without getting the error.
    Any ideas?
    Regards
    Nathan
    Kodo 2.5.3
    SQLServer 2000
    Code Snippet
    private static final int MAX_SCHEDULES_PER_TRANS = 10;
    while (!terminated) {
    Collection col = (Collection) getQuery().execute(currentDate); //
    getQuery() method Creates query object once and reused in subsequent calls
    Iterator events = col.iterator();
    int counter = 0;
    boolean committed = false;
    while (events.hasNext() && !committed && !terminated) {
    Event event = (Event) events.next();
    event.schedule()
    counter++;
    if ((counter == MAX_SCHEDULES_PER_TRANS ) || !events.hasNext()) {
    try {
    context.getPersist().commitTransaction();
    committed = true;
    catch (OptimisticLockException e) {
    context.getPersist().rollbackTransaction();
    break;
    getQuery().close(col);
    Kodo.properties
    # Kodo JDO Properties configuration
    # DEVELOPMENT
    com.solarmetric.kodo.LicenseKey: xxxxxxx
    com.solarmetric.kodo.ee.ManagedRuntimeProperties=TransactionManagerName=Tran
    sactionFactory
    javax.jdo.PersistenceManagerFactoryClass=com.solarmetric.kodo.impl.jdbc.JDBC
    PersistenceManagerFactory
    javax.jdo.option.ConnectionDriverName=com.microsoft.jdbc.sqlserver.SQLServer
    Driver
    javax.jdo.option.ConnectionUserName=xxxxx
    javax.jdo.option.ConnectionPassword=xxxx
    javax.jdo.option.ConnectionURL=jdbc:microsoft:sqlserver://devsnetsql01:1433;
    SelectMethod=cursor;DatabaseName=devsnet09
    javax.jdo.option.RetainValues=true
    javax.jdo.option.RestoreValues=true
    javax.jdo.option.Optimistic=true
    javax.jdo.option.NontransactionalWrite=false
    javax.jdo.option.NontransactionalRead=true
    javax.jdo.option.Multithreaded=true
    javax.jdo.option.MsWait=5000
    javax.jdo.option.MinPool=0
    javax.jdo.option.MaxPool=0
    javax.jdo.option.IgnoreCache=false
    com.solarmetric.kodo.FlushBeforeQueries=with-connection
    com.solarmetric.kodo.impl.jdbc.schema.DBSequenceFactory=20
    com.solarmetric.kodo.impl.jdbc.StatementCacheMaxSize=0
    com.solarmetric.kodo.impl.jdbc.WarnOnPersistentTypeFailure=true
    com.solarmetric.kodo.impl.jdbc.SequenceFactoryClass=com.solarmetric.kodo.imp
    l.jdbc.schema.DBSequenceFactory
    com.solarmetric.kodo.impl.jdbc.FlatInheritanceMapping=true
    com.solarmetric.kodo.impl.jdbc.AutoReturnTimeout=10
    com.solarmetric.kodo.Logger=stdout
    com.solarmetric.kodo.EnableQueryExtensions=true
    com.solarmetric.kodo.DefaultFetchThreshold=30
    com.solarmetric.kodo.DefaultFetchBatchSize=10
    com.solarmetric.kodo.impl.jdbc.TransactionIsolation=READ_COMMITTED
    com.solarmetric.kodo.ee.ManagedRuntimeProperties=TransactionManagerMethod=co
    m.ibm.ejs.jts.jta.TransactionManagerFactory.getTransactionManager
    com.solarmetric.kodo.ee.ManagedRuntimeClass=com.solarmetric.kodo.ee.Invocati
    onManagedRuntime
    Stack trace
    com.solarmetric.kodo.runtime.DataStoreException: java.sql.SQLException:
    [Microsoft][SQLServer 2000 Driver for JDBC]Object has been closed.
    [code=0;state=HY000]
    NestedThrowables:
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Object has
    been closed.
    at
    com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwDataStore(SQLExcep
    tions.java:64)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.instantiateRow(LazyRes
    ultList.java:223)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.get(LazyResultList.jav
    a:142)
    at java.util.AbstractList$Itr.next(AbstractList.java:431)
    at
    com.solarmetric.kodo.runtime.objectprovider.ResultListIterator.next(ResultLi
    stIterator.java:49)
    at com.mallesons.servicenet.ta.shared.BOIterator.next(BOIterator.java:48)
    at
    com.mallesons.servicenet.ta.event.SchedulerThread.process(Scheduler.java:171
    at com.mallesons.servicenet.ta.event.SchedulerThread.run(Scheduler.java:122)
    NestedThrowablesStackTrace:
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Object has
    been closed.
    at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown
    Source)(Inlined Compiled Code)
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown
    Source)(Inlined Compiled Code)
    at com.microsoft.jdbc.base.BaseConnection.validateClosedState(Unknown
    Source)(Inlined Compiled Code)
    at com.microsoft.jdbc.base.BaseStatement.validateClosedState(Unknown
    Source)(Inlined Compiled Code)
    at com.microsoft.jdbc.base.BaseResultSet.validateClosedState(Unknown
    Source)(Compiled Code)
    at com.microsoft.jdbc.base.BaseResultSet.getRow(Unknown Source)
    at
    com.solarmetric.datasource.ResultSetWrapper.getRow(ResultSetWrapper.java:465
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.instantiateRow(LazyRes
    ultList.java:186)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.get(LazyResultList.jav
    a:142)
    at java.util.AbstractList$Itr.next(AbstractList.java:431)
    at
    com.solarmetric.kodo.runtime.objectprovider.ResultListIterator.next(ResultLi
    stIterator.java:49)
    at com.mallesons.servicenet.ta.shared.BOIterator.next(BOIterator.java:48)
    at
    com.mallesons.servicenet.ta.event.SchedulerThread.process(Scheduler.java:171
    at com.mallesons.servicenet.ta.event.SchedulerThread.run(Scheduler.java:122)

    Thanks for pointing out the optimisticLockException catch error. That would
    have been a bug but it hasn't been hit yet as I've only ever run one
    instance of this app!!
    The BOIterator is just wrapper layer and I have removed it to ensure it is
    not the culprit. Still getting the same error.
    I have done some more testing and have narrowed down the problem a little.
    It seems to only occur when I update one of the columns that is being used
    in the query. If I update a column that is not used in the query, it works
    fine.
    com.solarmetric.kodo.runtime.DataStoreException: java.sql.SQLException:
    [Microsoft][SQLServer 2000 Driver for JDBC]Object has been closed.
    [code=0;state=HY000]
    NestedThrowables:
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Object has
    been closed.
    at
    com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwDataStore(SQLExcep
    tions.java:64)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.instantiateRow(LazyRes
    ultList.java:223)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.get(LazyResultList.jav
    a:142)
    at java.util.AbstractList$Itr.next(AbstractList.java:431)
    at
    com.solarmetric.kodo.runtime.objectprovider.ResultListIterator.next(ResultLi
    stIterator.java:49)
    at
    com.mallesons.servicenet.ta.event.SchedulerThread.process(Scheduler.java:197
    at com.mallesons.servicenet.ta.event.SchedulerThread.run(Scheduler.java:143)
    NestedThrowablesStackTrace:
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Object has
    been closed.
    at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.base.BaseConnection.validateClosedState(Unknown
    Source)
    at com.microsoft.jdbc.base.BaseStatement.validateClosedState(Unknown Source)
    at com.microsoft.jdbc.base.BaseResultSet.validateClosedState(Unknown Source)
    at com.microsoft.jdbc.base.BaseResultSet.getRow(Unknown Source)
    at
    com.solarmetric.datasource.ResultSetWrapper.getRow(ResultSetWrapper.java:478
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.instantiateRow(LazyRes
    ultList.java:186)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.get(LazyResultList.jav
    a:142)
    at java.util.AbstractList$Itr.next(AbstractList.java:431)
    at
    com.solarmetric.kodo.runtime.objectprovider.ResultListIterator.next(ResultLi
    stIterator.java:49)
    at
    com.mallesons.servicenet.ta.event.SchedulerThread.process(Scheduler.java:197
    at com.mallesons.servicenet.ta.event.SchedulerThread.run(Scheduler.java:143)
    2003-10-27 15:26:40,142 DEBUG - SchedulerThread.run() - exit
    "Marc Prud'hommeaux" <[email protected]> wrote in message
    news:[email protected]...
    Nathan-
    I guess you are right that it doesn't look like the query result is
    being kept open between commits. I do notice that the block that catches
    the OptimisticLockException doesn't break out of the loop though: can
    you check to ensure that one isn't getting thrown?
    Also, what is the com.mallesons.servicenet.ta.shared.BOIterator stuff?
    If it is a wrapper layer that you have around the query execution,
    can you try removing it, just to ensure that it isn't misbehaving in
    some way?
    In article <[email protected]>, nathan boyes wrote:
    Hi Marc,
    Bug 718 certainly seems similar, however I still don't think it is
    necessarily the problem in this case. That particular bug relates to the
    resultset that was opened prior to commit, not remaining open after the
    commit. However, once I've committed, I call query.closeAll() then re
    execute the query. I would expect this to give me a new resultset that
    would not be affected by the previous commit.
    Also the CURSOR_CLOSE_ON_COMMIT is disabled by default and we haven't
    enabled it. A query against the database using one of the SQLServer
    functions confirms that this setting is false on the server.
    Predictably, instantiating the entire collection also fixes the problem.
    I
    guess this is similar to setting DefaultFetchThreshold = -1.
    Not really sure what else to try.
    "Marc Prud'hommeaux" <[email protected]> wrote in message
    news:[email protected]...
    Nathan-
    This sounds to me like
    http://bugzilla.solarmetric.com/show_bug.cgi?id=718 , even though it is
    not known to happen for SQLServer. If, before you commit, you
    instantiate the entire "col" list (with something like
    "new LinkedList (col)"), do you still see the problem?
    If this is indeed the problem, it seems that this is a server option
    that you can configure. If you disable CURSOR_CLOSE_ON_COMMIT on the
    server, do you still see the problem? See:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_set-set_48kz.asp
    >>>
    >>>
    >>>
    >>>
    In article <[email protected]>, nathan boyes wrote:
    I have upgraded to 2.5.5 and am now calling query.closeAll() neither
    of
    which had any effect. When I set DefaultFetchThreshold to -1, thenthe
    problem disappeared.
    For efficiency, if I am iterating through 50 objects beforecommitting
    then
    it is probably worth setting
    DefaultFetchThreshold=50
    DefaultFetchBatchSize=50
    which will run without problem.
    However, that doesn't address the underlying problem that could stilloccur
    in other parts of our system.
    "Stephen Kim" <[email protected]> wrote in message
    news:[email protected]...
    First can you upgrade to Kodo 2.5.4 and see if the problem persists?
    If so, can you for the sake of debugging try setting
    DefaultFetchThreshold to -1?
    Also you should be calling either query.closeAll () or query.close(events).
    nathan boyes wrote:
    Hi guys
    I've discovered an unusual behaviour when iterating through a
    collection
    returned from a query.
    Scenario
    The code executes a query, iterates partially through the
    resultset
    and
    for
    each row calls a method which creates another object. Given that
    there
    could be thousands of rows, I commit the new objects every n timesand
    then
    go back to the start of the loop which re-executes the query. This
    code
    runs
    fine when
    MAX_SCHEDULES_PER_TRANS <=
    com.solarmetric.kodo.DefaultFetchBatchSize.
    Problem
    If the DefaultFetchBatchSize is 10, and I commit every 11
    iterations,
    then
    during the 3rd outer loop (ie commit has succeeded twice and the
    query
    has
    been executed 3 times) an exception is thrown when calling
    events.next()
    on
    the 10th element. The stack trace is included below, but it
    appears
    that
    the query resultset is somehow being closed early.
    If I increase the DefaultFetchBatchSize to 20, then I can also
    increase
    my
    MAX_SCHEDULES_PER_TRANS to 20 without getting the error.
    Any ideas?
    Regards
    Nathan
    Kodo 2.5.3
    SQLServer 2000
    Code Snippet
    private static final int MAX_SCHEDULES_PER_TRANS = 10;
    while (!terminated) {
    Collection col = (Collection) getQuery().execute(currentDate);
    getQuery() method Creates query object once and reused insubsequent
    calls
    Iterator events = col.iterator();
    int counter = 0;
    boolean committed = false;
    while (events.hasNext() && !committed && !terminated) {
    Event event = (Event) events.next();
    event.schedule()
    counter++;
    if ((counter == MAX_SCHEDULES_PER_TRANS ) ||
    !events.hasNext()) {
    >>>>>>
    try {
    context.getPersist().commitTransaction();
    committed = true;
    catch (OptimisticLockException e) {
    context.getPersist().rollbackTransaction();
    break;
    getQuery().close(col);
    Kodo.properties
    # Kodo JDO Properties configuration
    # DEVELOPMENT
    com.solarmetric.kodo.LicenseKey: xxxxxxx
    com.solarmetric.kodo.ee.ManagedRuntimeProperties=TransactionManagerName=Tran
    sactionFactory
    javax.jdo.PersistenceManagerFactoryClass=com.solarmetric.kodo.impl.jdbc.JDBC
    PersistenceManagerFactory
    javax.jdo.option.ConnectionDriverName=com.microsoft.jdbc.sqlserver.SQLServer
    Driver
    javax.jdo.option.ConnectionUserName=xxxxx
    javax.jdo.option.ConnectionPassword=xxxx
    javax.jdo.option.ConnectionURL=jdbc:microsoft:sqlserver://devsnetsql01:1433;
    SelectMethod=cursor;DatabaseName=devsnet09
    javax.jdo.option.RetainValues=true
    javax.jdo.option.RestoreValues=true
    javax.jdo.option.Optimistic=true
    javax.jdo.option.NontransactionalWrite=false
    javax.jdo.option.NontransactionalRead=true
    javax.jdo.option.Multithreaded=true
    javax.jdo.option.MsWait=5000
    javax.jdo.option.MinPool=0
    javax.jdo.option.MaxPool=0
    javax.jdo.option.IgnoreCache=false
    com.solarmetric.kodo.FlushBeforeQueries=with-connection
    com.solarmetric.kodo.impl.jdbc.schema.DBSequenceFactory=20
    com.solarmetric.kodo.impl.jdbc.StatementCacheMaxSize=0
    com.solarmetric.kodo.impl.jdbc.WarnOnPersistentTypeFailure=true
    com.solarmetric.kodo.impl.jdbc.SequenceFactoryClass=com.solarmetric.kodo.imp
    l.jdbc.schema.DBSequenceFactory
    com.solarmetric.kodo.impl.jdbc.FlatInheritanceMapping=true
    com.solarmetric.kodo.impl.jdbc.AutoReturnTimeout=10
    com.solarmetric.kodo.Logger=stdout
    com.solarmetric.kodo.EnableQueryExtensions=true
    com.solarmetric.kodo.DefaultFetchThreshold=30
    com.solarmetric.kodo.DefaultFetchBatchSize=10
    com.solarmetric.kodo.impl.jdbc.TransactionIsolation=READ_COMMITTED
    com.solarmetric.kodo.ee.ManagedRuntimeProperties=TransactionManagerMethod=co
    m.ibm.ejs.jts.jta.TransactionManagerFactory.getTransactionManager
    com.solarmetric.kodo.ee.ManagedRuntimeClass=com.solarmetric.kodo.ee.Invocati
    onManagedRuntime
    Stack trace
    com.solarmetric.kodo.runtime.DataStoreException:java.sql.SQLException:
    [Microsoft][SQLServer 2000 Driver for JDBC]Object has been closed.
    [code=0;state=HY000]
    NestedThrowables:
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver forJDBCObject
    has
    been closed.
    at
    com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwDataStore(SQLExcep
    tions.java:64)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.instantiateRow(LazyRes
    ultList.java:223)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.get(LazyResultList.jav
    a:142)
    at java.util.AbstractList$Itr.next(AbstractList.java:431)
    at
    com.solarmetric.kodo.runtime.objectprovider.ResultListIterator.next(ResultLi
    stIterator.java:49)
    atcom.mallesons.servicenet.ta.shared.BOIterator.next(BOIterator.java:48)
    >>>>>>
    at
    com.mallesons.servicenet.ta.event.SchedulerThread.process(Scheduler.java:171
    atcom.mallesons.servicenet.ta.event.SchedulerThread.run(Scheduler.java:122)
    >>>>>>
    NestedThrowablesStackTrace:
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver forJDBCObject
    has
    been closed.
    at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown
    Source)(Inlined Compiled Code)
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown
    Source)(Inlined Compiled Code)
    at
    com.microsoft.jdbc.base.BaseConnection.validateClosedState(Unknown
    Source)(Inlined Compiled Code)
    atcom.microsoft.jdbc.base.BaseStatement.validateClosedState(Unknown
    Source)(Inlined Compiled Code)
    atcom.microsoft.jdbc.base.BaseResultSet.validateClosedState(Unknown
    Source)(Compiled Code)
    at com.microsoft.jdbc.base.BaseResultSet.getRow(Unknown Source)
    at
    com.solarmetric.datasource.ResultSetWrapper.getRow(ResultSetWrapper.java:465
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.instantiateRow(LazyRes
    ultList.java:186)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.get(LazyResultList.jav
    a:142)
    at java.util.AbstractList$Itr.next(AbstractList.java:431)
    at
    com.solarmetric.kodo.runtime.objectprovider.ResultListIterator.next(ResultLi
    stIterator.java:49)
    atcom.mallesons.servicenet.ta.shared.BOIterator.next(BOIterator.java:48)
    >>>>>>
    at
    com.mallesons.servicenet.ta.event.SchedulerThread.process(Scheduler.java:171
    atcom.mallesons.servicenet.ta.event.SchedulerThread.run(Scheduler.java:122)
    >>>>>>
    >>>>>>
    >>>>>
    Stephen Kim
    [email protected]
    SolarMetric, Inc.
    http://www.solarmetric.com
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Need query result

    Hi friends,
    In my Query designer we have used material,plant,suite,style and two keyfigures.
    I give only suite as selection..ex. suite = 10.
    the output of my query is like
    material    plant  suite   value1   value2    total
    101         A       10       25          2          50
    103         A        10      35         3          105
    107         A        10       15        4            60
    104         A        10       20        1            20
    105         A         10      55        2          110
                        Total                    150       12        345  
    my requirement is I need only Total of total Value(i.e 345 ) without displaying material numbers....
    If  I use material as free characteristics, the total will be ( 150*12 = 1800). it is wrong.
    so, how can I get total(345) only in my query..... is any possibility? if yes, guide me........
    with hopes
    JD...
    Edited by: jaya durai on Apr 15, 2008 8:23 AM
    Edited by: jaya durai on Apr 15, 2008 8:24 AM
    Edited by: jaya durai on Apr 15, 2008 8:25 AM

    hi Raj,
    Already I have tried this, It still appears 1800... is have any function module or user exit, if yes, tell me...
    If I hide material, the result displayed in 6th row. because 5 rows for material...   but I need only one row which should have only total value..anyhow, thanks for response....
    with hopes,
    JD

  • How to show only the result line of a Query result ?

    Hi Experts,
    I want to show only the result line of the Query. Is this possible in query Designer ?
    In BeX Workbook, I can hide the rows but they grow or shrink dynamically and hence it is unpredictable how many rows to suppress.
    If you have any solutions/workarounds, please reply !
    Rekha

    VBA coding can be used to display just the Result rows.
    Somthing like this - modify as needed.
    This scans the range of query results looking to find the last row, then checks those rows to see if the word Result is found or not, deleting (or you could just hide) the detail rows.  There is also a LEAF option in BEx Boolean options that returns a 1 or 0 depending on whether a row is a detail or result that could also be used to hide rows rather than looking for the presence of "Result" in a particular column
    Sub SAPBEXonRefresh(queryID As String, resultArea As Range)
    For rownum = 17 To 64000 Step 1
    ' col 2 is the Total Result, col 3 is the User Group result
    If Cells(rownum, 2) = "" And Cells(rownum, 3) = "" Then
    lastrow = rownum - 1
    Exit For
    End If
    Next
    For rownum = lastrow To 17 Step -1
    If Cells(rownum, 2) = "Result" Or Cells(rownum, 3) = "Result" Then
    Rows(rownum).Hidden = False
    Else
    ' Rows(rownum).Hidden = True
    Rows(rownum).EntireRow.Delete
    End If
    Next
    End Sub

  • Getting query results from a PL/SQL procedure

    Hi! So, I’m a little stumped and I can’t seem to find the answer to what I believe is probably a simple question…
    So, here goes… I have a big ol’ union query that I use to create a report on a page, it’s about 25k – not over the 32k limit, but fails to be able to compile every time (I always get a 400 – Bad Request error). I’m not sure why this is happening, but I can remove a union statement and it compiles just fine – so it has something to do with the size of the query. ANYWAY – I’ve resolved that I should put this bad boy into the database as a stored procedure and just call it from Apex, my problem is I can’t figure out quite how to do this with variables, etc.…
    Instead of giving you my whole big query, I’ll use the emp table as the concept is the same:
    Say we have a query that creates a report on a page:
    select empno, ename, job, mgr, hiredate, sal, comm, deptno
    from emp
    where job = :P_JOB
    and hiredate >= :P_HIREDATE;
    How would I take this query, create it as a stored procedure on the db, pass the variables from Apex and return the query result set from the stored proc as a report?
    I really appreciate any help on this!
    Best,
    Gilcrest

    Hi Gilcrest,
    You should create the query as a View and use the view name and the WHERE clause in the report's sql source.
    Andy

  • Sending email using PL/SQL based on a query result

    Hello all,
    I want to create a procedure using PL/SQL, based on a query result.Here is the scenario:
    I have multiple tables in Target and Source databases that I want to compare(not the whole table but queries on these tables) and if they differ, I want to shoot an email. I have some ideas how to implement this but not sure whether it is the best approach.
    select Acct_id, total from SourceTableA
    minus
    select Acct_id, total from TargetTableA
    select Acct_id, sum from SourceTableB
    minus
    select Acct_id, sum from TargetTableB
    If the result of any of above queries > 0 then I want to shoot an email and want to repeat this procedure in the morning every day.
    I know how to implement send_mail procedure using UTL_SMTP package and how to schedule tha job by dbms_job package. But I am not sure how to implement the result of minus query. In case if minus > 0 then I also want to send the name of tables in the email message where source and target tables are not same. Should i use cursor, variable or insert the result in a new table? any help would be highly appreciated. Thanks in advance.
    Khan

    Actually these queries are the part of our daily testing that we run everyday manually(after the scheduled ETL load) to see if there are any discrepencies between our datawarehouse tables and source tables. So instead of running these queries manually everyday we want to schedula a procedure that will shoot an email in case of any discrepency and indicate which tables have problems.

  • How can I get Numbers to return the first row in a group of VLOOKUP query results instead of last one?

    I'm trying to query from one table (call it Table1) a batch of rows in another table (Table2) using VLOOKUP on a date specified in the first table (Table1). My problem is it's returning the last incident in Table2 of the requested date instead of the first incident. This really breaks the OFFSET scheme I'd like to use to collect the rest of the items for that date. Is there some way to compel VLOOKUP to return the first row of query results, not the last?
    NOTE: I see I've asked this before, but forgot to go back and look at responses given. It's been a while and I've limped along until now with the way things were. I'm actually trying to delete this questions, so if you see it, ignore it. I suppose if someone can tell me real quick how to delete a stupid question, that might be helpful.

    you cannot delete a post yourself.  You can flag the post an request a moderator remove.

  • Warning Message in query result as 'Notification Number DBMAN 345'

    Hi ,
    I have a warning message while executing the query
    'Diagnosis
    Currently, it cannot be guaranteed that SIDs and master data exists for all characteristic attributes for the DataStore object to be read.
    There is a restriction on a navigation attribute of the listed characteristic in the query. This filters all characteristic values of the master-data bearing characteristic for which there is not yet master data out of the result.
    For performance reasons, this filtering is unavoidable.
    System Response
    Procedure
    In case of doubt, find other restirctions directly on the characteristic values of the characteristics contained in the DataStore object.
    Procedure for System Administration
      Notification Number DBMAN 345  '
    'i am getting this error because of cutomer exit variables  on navigatioanl attributes of  Omaterial'
    I tried supressing it in  RSRT.. but unable to find the message.
    I tried  debugging and assigning enhancement points in  FM  BAL_LOG_MSG_READ.. As it is standard function module its not suggestable to do..
    can we creat custom FM ?? will it be called if we  write code to supress warning message??
    Please let me know how to use  BADI'S  in order to supress the error message that appearing in query result?
    Thanks All.

    Hi,
    The warning is raised due to the following reasons:
      - you have a selection in the filter of a navigation attribute
      - in your DSO you do not use the option "SIDs Generation upon Activation"
    If the option "SIDs Generation upon Activation" is not flagged,
    you may get char.values for an Infoobject in the system not
    having any SIDs. As a result you may see in the report less data as
    expected.
    For example we have Infoobject A with its Nav.attribute B
      Infoobject A   Nav.attribute B
      12             13   ->> has a SID in the X-table
      11             10
      9              13   ->> has no SID in the X-table
    If you define a selection on B =13 in the query, you only get infoobject
    A with key 12 displayed in the result, since only B =13 has a SID
    in the relevant X-table.
    The warning refers to this behaviour and cannot be avoided unless you:
       - flag the option in the ODS-settings
       - or remove the filter defined on 0MATERIAL__xxxx
    Thanks,
    Venkat

  • Saving query results to a flat file

    Hello Experts!
    We have a very specific issue on our current project and I would like to know if any of you have ever done something similar. We are taking query results from BW (after complex calculations, some based on SY-DATE) and saving them to flat files to transfer to a SQL database structure on the Enterprise Portal. From here, the portal team renders the information into more "static" dashboards that include mouse over features and even limited drilldown (i.e. no matter where a user clicks the report always drills down on profit center)
    There are many reasons why the model is set up as such (mostly training of executive level end users), and even though it doesn't mesh with the idea that BW could do this work on its own, we have to work with what we have.
    We have come up with 3 possible ways to save this data to flat files and hopefully someone can tell us which might be the most effective.
    1.) Information Broadcasting. If we broadcast XML files to the portal, will the portals team be able to read that data into a SQL database? Is there another way to use broadcasting to create and send a flat file to specific location?
    2.) RSCRM_BAPI. This transaction seems to not support texts.
    3.) Open Hub. In order to get the open hub to work, we first have to save all of our query results to direct write data store objects using APD. (calculations based on current date, for example, would require daily full loads to the underlying data providers otherwise.)
    What is the best way to accomplish this? Is information broadcasting capable of doing this?
    Thanks!

    Hi Adam,
    Do you have to use flat files to load the information to a SQL database? (if so maybe someone else has a suggestion on which way would be the best).
    I try to stay away from flat file uploads as there is a lot of manual work involved. May I suggest setting up a connection to your SQL table in the DBCON table and then writing a small abap program to push data into the SQL database (which you can automate).
    1) Use APD to push data into a table within BW.
    2) Go to transaction SM30 > table DBCON and setup a new entry specifying the conncection parameters to your SQL database.
    3) In SE38 Write an ABAP program along the folloing lines (assuming the connection you set in DBCON is named conn1:
    data: con_name like dbcon-con_name
    con_name = 'conn1'.
    exec sql.
      set connection :con_name
    endexec.
    ****have a select statement which reads data from your table which the data is saved from the APD into an internal table**********
    ****loop on the internal table and have a SQL insert statement to insert the records into the SQL table as below******
    exec sql.
    insert into <SQL TABLE> (column names seperated by ,)
    values (column names of the internal table seperated by ,)  if the internal table is named itab the columns have to be specified as :itab-column1
    If you decide to take this approach you may find more info on DBCON and the process in sdn. Good Luck!
    endexec.

  • Large query result set

    Hi all,
    At the moment we have some java classes (not ejb - cmp/bmp) for search in
    our ejb application.
    Now we have a problem i.e. records have grown too high( millions ) and
    sometimes query results in retrieval of millions of records. It results in
    too much memory consumtion in our ejb application. What is the best way to
    address this issue.
    Any help will be highly appreciated.
    Thanks & regards,
    Parvez

    you can think of following options
    1) paging: read only few thousands at a time and maintain a index to page
    through complete dataset
    2) caching!
    a) you can create a serialized data file in server to cache the result set
    and can use that to browse through. you may do on the fly
    compression/uncompression while sending data to client.
    b) applet based solution where caching could be in client side. Look in
    http://www.sitraka.com/software/jclass/cs_ims.html
    thanks,
    Srinivas
    "chauhan" <[email protected]> wrote in message
    news:[email protected]...
    Thanks Slava Imeshev,
    We already have search criteria and a limit. When records exceeds thatlimit
    then we prompt user that it may take sometime, do you want to proceed? If
    he clicks yes then we retrieve those records. This results in lot ofmemory
    consumtion.
    I was thinking if there is some way that from database I can retrieve some
    block of records at a time rather the all records of a query. I wander how
    internet search sites work, where thousnds of sites/pages match criteriaand
    client can move back & front on any page.
    Regards,
    Parvez
    "Slava Imeshev" <[email protected]> wrote in message
    news:[email protected]...
    Hi chauhan,
    You may want to narrow search criteria along with processing a
    limited number of resulting records. I.e. if the size of the result
    is bigger than a limit, you stop fetching results and notify the client
    that search criteria should be narrowed.
    HTH.
    Regards,
    Slava Imeshev
    "chauhan" <[email protected]> wrote in message
    news:[email protected]...
    Hi all,
    At the moment we have some java classes (not ejb - cmp/bmp) for
    search
    in
    our ejb application.
    Now we have a problem i.e. records have grown too high( millions ) and
    sometimes query results in retrieval of millions of records. It
    results
    in
    too much memory consumtion in our ejb application. What is the best
    way
    to
    address this issue.
    Any help will be highly appreciated.
    Thanks & regards,
    Parvez

  • How to use one query results in another query

    hi,
    in help.sap I have founded that using variable type replacement path I can use one query results in another query. It is wrote there that I have to choose query name results I want to get in variable definition but I do not know where.
    How I can do this?
    Result I want to get is:
    In one query I have material prices in another material quantities. I want to calculate inventory value (price * quantity). Moreover prices are on plant level, quantities on storage type level. Plant is atribute of storage type.
    Can I do this?
    Regards,
    Andrzej

    Hi Andrzej,
    please check out this thread: Set parameters values depending on other parameters
    I had a discussion about query results as input for another query in there.
    For creating a workbook, just click on the save button after you ran your query in the bex.
    Siggi
    Message was edited by: Siegfried Szameitat

Maybe you are looking for

  • YouTube Search in non-English

    Does any one know if there is a way to input non-English in the YouTube Search?

  • HT1351 hard drive crashed

    Hi All I need help, Itunes wont let me sync to the new music library i re-ripped onto my new re built comp without losing the songs I already had on my ipod. There are a lot of songs I bought off itunes that are not there anymore in my new library, H

  • Client wont connect to closest AP

    hi every one this is the second post. the first one is missing! long story short, client connection is random. doesnt connect to the closest AP. i have situation like 40 clients connected to one AP and 2 meter away an AP only servicing 4 !  i have wl

  • HT4528 I just ordered 2 new iPhones from Verizon.  Can I purchase Apple Care on them?

    I just ordered new iPhones from Verizon. Can I purchase Apple Care on these since I didn't get them directly from Apple?

  • SAP 5.0 Release Notes for PM Module

    Any body can tell me the path to see the SAP Release Notes 5.0 of Plant Maintenance Module. So I can see the the Difference between 4.7 C & 5.0 Release Notes. Regards,