Strategy pattern question.

Can the following scenario be called strategy pattern?
public class StrategyExecutor {
     public static void main(String[] args) {
          Strategy[] strategies = {new FirstImpl(), new SecondImpl()};
          for(int i = 0; i < strategies.length; i++){
               System.out.print("Strategy ["+ i +"] ");
               strategies.solve();
public interface Strategy {
     public void solve();
public abstract class AbstractClass implements Strategy{
     public void solve(){
          int result = getFirstParam()+getSecondParam();
          System.out.println(" Result "+result);
     protected abstract int getSecondParam();
     protected abstract int getFirstParam();
public class FirstImpl extends AbstractClass {
     protected int getSecondParam() {          
          return 22;
     protected int getFirstParam() {          
          return 11;
public class SecondImpl extends AbstractClass {
     protected int getSecondParam() {
          return 44;
     protected int getFirstParam() {          
          return 33;

To be a perfect fit for Strategy pattern, if the abtract class which has the template to solve() is not there and the actual algorithm is down in the FIrstImpl, SecondImpl then its a true strategy?
Design point of view it can be a strategy pattern..
but If you see from the the context and the programs
objective, It is not strategy pattern

Similar Messages

  • Strategy Pattern, Am i on the right Track?

    The question:
    Design a small, prototype, application, which creates, stores and amends warehouse records. This may have little more than a StockItem class.
    Using each of the patterns Strategy, Decorator, Adaptor and in turn provide three different adaptations to your prototype application which will enable a user to view the warehouse records in at least three different ways, e.g. by location, alphabetically, by value, by quantity in stock, as continuous plain text, as formatted text, in a list pane, as a printout etc
    My Code
    package warehouse;
    public class StockItem
        private int id;
        private String describtion;
        private double price;
        private int  quantity;
        private String location;
        ViewByLocationBehavior locationVar;
        public StockItem()
        public void setId(int id)
            this.id=id;
        public int getId()
            return id;
        public void setDescribtion(String describtion)
            this.describtion=describtion;
        public String getDescribtion()
            return describtion;
         public void setPrice(double price)
            this.price=price;
        public double getPrice()
            return price;
        public void setQuantity(int quantity)
            this.quantity=quantity;
        public int getQuantity()
            return quantity;
        public void setLocation(String location)
            this.location=location;
        public String getLocation()
            return location;
        public void setViewByLocationBehavior(ViewByLocationBehavior locationVar )
            this.locationVar=locationVar;
       public void displayByLocation()
        locationVar.displayByLocation();
        public String toString()
            return String.format("%d %S %f %d %S",id ,describtion,price,quantity,location);
    }The interface
    package warehouse;
    public interface ViewByLocationBehavior
        void displayByLocation();
    }Concrete classes arepackage warehouse;
    public class PlainText extends StockItem implements ViewByLocationBehavior
        public void displayByLocation()
            System.out.println("Display PlainText");
    package warehouse;
    public class FormattedText extends StockItem implements ViewByLocationBehavior
        public void displayByLocation()
            System.out.println("Display Formatted Text ");
    package warehouse;
    public class ListPane extends StockItem implements ViewByLocationBehavior
        public void displayByLocation()
            System.out.println("Display ListPane");
    package warehouse;
    public class PrintOut extends StockItem implements ViewByLocationBehavior
        public void displayByLocation()
            System.out.println("Display PrintOut ");
    package warehouse;
    public class StockTest
        public static void main(String args[])
            StockItem obj = new StockItem();
            obj.setViewByLocationBehavior(new PlainText());
            obj.displayByLocation();
            System.out.println(obj.toString());
    }But my questions is Am i on the right track applying the Strategy pattern?
    Because next i will make the other Interfaces: View by alphabetically, by value, by quantity, and their Concrete Classes are
    Display as continuous plain text, formatted text, in a list pane, and printout.
    Each interface have four concrete classes
    Need your comments Please?

    But my questions is Am i on the right track applying
    the Strategy pattern?Your assignment explicitly calls for the strategy pattern:
    "> Using each of the patterns Strategy, Decorator,
    Adaptor and in turn provide three different
    adaptations to your prototype application which will
    enable a user to view the warehouse records in at
    least three different ways, e.g. by location,
    alphabetically, by value, by quantity in stock, as
    continuous plain text, as formatted text, in a list
    pane, as a printout etc"I'm not sure I care for that interface much. I would have expected something more like this (I'm not 100% sure about the parameter that I'd pass, if any):
    public interface StockItemFilter
        List<StockItem> filter(List<StockItem> unfilteredStockItems);
    }Now you'll pass in an unfiltered List of StockItems and return the List of appropriate StockItems filtered alphabetically, by location, etc. If you want to combine the fetching of StockItems with filtering, replace the unfiltered List with some Criterion.
    Your ViewByLocationBehavior doesn't seem to accept any input or return anything. What good is it?
    %

  • How to implement Strategy pattern in ABAP Objects?

    Hello,
    I have a problem where I need to implement different algorithms, depending on the type of input. Example: I have to calculate a Present Value, sometimes with payments in advance, sometimes payment in arrear.
    From documentation and to enhance my ABAP Objects skills, I would like to implement the strategy pattern. It sounds the right solution for the problem.
    Hence I need some help in implementing this pattern in OO. I have some basic OO skills, but still learning.
    Has somebody already implemented this pattern in ABAP OO and can give me some input. Or is there any documentation how to implement it?
    Thanks and regards,
    Tapio

    Keshav has already outlined required logic, so let me fulfill his answer with a snippet
    An Interface
    INTERFACE lif_payment.
      METHODS pay CHANGING c_val TYPE p.
    ENDINTERFACE.
    Payment implementations
    CLASS lcl_payment_1 DEFINITION.
      PUBLIC SECTION.
      INTERFACES lif_payment.
      ALIASES pay for lif_payment~pay.
    ENDCLASS.                 
    CLASS lcl_payment_2 DEFINITION.
      PUBLIC SECTION.
      INTERFACES lif_payment.
      ALIASES pay for lif_payment~pay.
    ENDCLASS.                   
    CLASS lcl_payment_1 IMPLEMENTATION.
      METHOD pay.
        "do something with c_val i.e.
        c_val = c_val - 10.
      ENDMETHOD.                   
    ENDCLASS.                  
    CLASS lcl_payment_2 IMPLEMENTATION.
      METHOD pay.
        "do something else with c_val i.e.
        c_val = c_val + 10.
      ENDMETHOD.  
    Main class which uses strategy pattern
    CLASS lcl_main DEFINITION.
      PUBLIC SECTION.
        "during main object creation you pass which payment you want to use for this object
        METHODS constructor IMPORTING ir_payment TYPE REF TO lif_payment.
        "later on you can change this dynamicaly
        METHODS set_payment IMPORTING ir_payment TYPE REF TO lif_payment.
        METHODS show_payment_val.
        METHODS pay.
      PRIVATE SECTION.
        DATA payment_value TYPE p.
        "reference to your interface whcih you will be working with
        "polimorphically
        DATA mr_payment TYPE REF TO lif_payment.
    ENDCLASS.                  
    CLASS lcl_main IMPLEMENTATION.
      METHOD constructor.
        IF ir_payment IS BOUND.
          me->mr_payment = ir_payment.
        ENDIF.
      ENDMETHOD.                  
      METHOD set_payment.
        IF ir_payment IS BOUND.
          me->mr_payment = ir_payment.
        ENDIF.
      ENDMETHOD.                  
      METHOD show_payment_val.
        WRITE /: 'Payment value is now ', me->payment_value.
      ENDMETHOD.                  
      "hide fact that you are using composition to access pay method
      METHOD pay.
        mr_payment->pay( CHANGING c_val = payment_value ).
      ENDMETHOD.                   ENDCLASS.                  
    Client application
    PARAMETERS pa_pay TYPE c. "1 - first payment, 2 - second
    DATA gr_main TYPE REF TO lcl_main.
    DATA gr_payment TYPE REF TO lif_payment.
    START-OF-SELECTION.
      "client application (which uses stategy pattern)
      CASE pa_pay.
        WHEN 1.
          "create first type of payment
          CREATE OBJECT gr_payment TYPE lcl_payment_1.
        WHEN 2.
          "create second type of payment
          CREATE OBJECT gr_payment TYPE lcl_payment_2.
      ENDCASE.
      "pass payment type to main object
      CREATE OBJECT gr_main
        EXPORTING
          ir_payment = gr_payment.
      gr_main->show_payment_val( ).
      "now client doesn't know which object it is working with
      gr_main->pay( ).
      gr_main->show_payment_val( ).
      "you can also use set_payment method to set payment type dynamically
      "client would see no change
      if pa_pay = 1.
        "now create different payment to set it dynamically
        CREATE OBJECT gr_payment TYPE lcl_payment_2.
        gr_main->set_payment( gr_payment ).
        gr_main->pay( ).
        gr_main->show_payment_val( ).
      endif.
    Regads
    Marcin

  • Can delegate and strategy patterns coexist ?

    Say I have an interface for persistence call that PersistenceInterface.
    Now for MySQL I created MySQLPersistenceClass and for DB2 I created one more class DB2PersistenceClass.
    Now to proceed with my busines slogic I have a class BusinessLogicHandler class.
    BusinessLogicHandler has a class member say persistenceObject of type PersistenceInterface. Now certainly I'm switching the persistence based on the actual implementation so I say Im using STRATEGY pattern here
    But for create operation from business layer i.e. BusinessLogicHandler.create directly invokes persistenceObject.create in this case can I say that Im using DELEGATE pattern also
    So can I say the set of classes and interface = DELEGATE + STRATEGY ?
    Thanks a lot

    Can someone please answer this ?yes
    can I say the set of classes and interface = DELEGATE + STRATEGY ?yes
    Can delegate and strategy patterns coexist ?yes
    I'd say it would be odd to use Strategy not as a delegate.

  • Strategy Pattern and HotSpot optimization

    I wonder whether using the Strategy Pattern affects HotSpot optimizations such as inlining. Assume for a non trivial operation that has to be done often there exist two alternatives which are frequently exchanged (i.e. the flag in the example changes its value frequently). Originally code looked like this:if ( caseSensitive ) {
       caseSensitiveComparison( strA, strB );
    else {
       caseInsensitiveComparison( strA, strB );
    }Assume both methods are private then that code can be inlined quite easily by the HotSpot engine.
    If we now delegate to a StringComparator (defined as interface and implemented by two singletons) we getcomparator.compareStrings( strA, strB );Is the VM still able to inline this? Or is it likely that overall performance degrades since the virtual call is not optimized away?
    Any ideas?
    Thanks!
    robert
    For further info on the Strategy Pattern see here
    http://c2.com/cgi/wiki?StrategyPattern

    That's true, but OTOH he describes a realistic (?)
    scenario in the first paragraph that explains inlining
    could occur.That's good news.
    However, what I found more valuable is his statement,
    that a virtual call is not necessarily worse than a
    local conditional (branch prediction hassles).Just to be clear, I'm not advocating the use of if instead of Strategy in some hope that it will result in inlining. Personally, I feel that the whole idea that OO slows things down is overblown. While it may add complications and more instructions at a microscopic level, OO often simplfies and reduces actions at a macroscopic level.
    I'm more interested in knowning what are the inlining requirements and triggers. Along the lines of the understanding why it's sometimes bad practice to use + for String concatenation, I'd like to know if there are simple things that can be done to improve performance with out changing the overall design.
    If anyone has any information on this it would be much appreciated.

  • Filemonitor - Strategy pattern?

    Hi all.
    I have an application that I think needs to use the strategy pattern but I'm not sure.
    I'm fairly new to design patterns but I would like to be able to use the right one and as yet I can't see which one to use and where.
    My first instance of the application places a listener on a file in the local file system and when the modified date of that file changes it notifies the application that the file has changed.
    Fairly simple.
    I have a need now to monitor files not only on the local file system but also on a ftp server.
    I thought of adding this into the class but then I thought "what would happen if I wanted to monitor a file in a database, on a remote system, somewhere I hadn't thought of, etc".
    So a design pattern was needed... but which one.
    I thought the Strategy pattern looked best from my reading but I'm not sure. I don't want to use the wrong pattern and end up having a more complicated design than I started with.
    I hope someone can help. If I haven't put enough information here then I do apologize and will put more if requested.
    Thanks in advance.
    All the best,
    Tony

    As of my knowledge ,startegy pattern would best fit.
    You can have an abstract strategy class
    public abstarct FileMontor {
    abstract void checkFile(Object file);
    public class LocalFileMonitor extends FileMonitor
    //Override the method checkFile(Object file) and write code
    public class DBFileMonitor
    //Override the method checkFile(Object file) and write code
    //In the same fashio we can keep on creating the strategies.
    But now the problem is who decides which strategy to use at what point of time, is there a way i can register the various strategies ...
    So you should have register cum controller class, where you can register all ur strategies.. and it should have intelligenece to choose the strategy at runtime from the input it is receving at runtime.

  • Strategy Pattern Q

    Hi,
    I've been reading about the Strategy Pattern and I would liek to implement into one of my own small projects.
    I have an application called WatchDog, this application checks some directories (provided as parameter) and puts every item in a directory in an appropriate mysql table.
    I have this section in my code:
    private void insertFile(File aFile, String arg) {
              if (arg.equals("/EBooks"))
                   qry.InsertEbook(aFile);
              else if (arg.equals("/MP3"))
                   qry.insertMP3(aFile);
                    else if (arg.equals("/Videos"))
                   qry.insertVideo(aFile);
         }this looks like a perfect candidate for Strategy Pattern to me?
    But I'm struggling with the design.
    The concept is an insert query, or simpler a query right?
    The strategy interface is DataType (EBooks, MP3, Videos, ...)
    And Ebook, MP3, Video are ConcreteStrategy classes then???
    Can anybody give some clarification on this one pls?
    grtz

    Not necessarily the Strategy Pattern proper or the best possible solution but you could do something like this:
    interface FileHandler
       public void handle(File file);
    }And then in in another class:
    private Map<String, FileHandler> handlers = new HashMap<String, FileHandler>();
    // fill the map with a handler for each directory
    private void insertFile(File aFile, String arg) {
       handlers.get(arg).handle(aFile);
    }

  • Display pattern questions

    I would like to be able to set up a display patter that will add some asterisks or some other characters on each side of what ever a user enters in a field in order to flag the text. Is that possible? or is there a better way to do this than using display patters. I check the Designer help but could find much to answer my question.

    Amanda,
    Try to put a single quote around the parenthesis like this:
    '('$ZZ,ZZ9.99')' for your display pattern.

  • Regex pattern question

    Hi,
    I'm trying to get my feet wet wtih java and regular expressions, done a lof of it in perl, but need some help with java.
    I have an xml file (also working through the sax tutorial, but this question is related to regex)that has multiple elements, each element has a title tag:
    <element lev1>10<title>element title</title>
    <element lev2>20<title>another element title</title>
    </element lev2>
    </element lev1>If I have the following pattern:
    Pattern Title = Pattern.compile("(?i)<title>([^<]*)</title>");that picks up the titles, but I can't distinguish which title belongs to which element. Basically what I want to have is:
    Pattern coreTitle = Pattern.compile("(?i)<element lev1>(**any thing that isn't an </title> tag**)</title>");looked through the tutorials, will keep looking, I'm sure it's in there somewhere, but if someone could point me in the right direction, that would be great.
    thanks,
    bp

    Just guessing, but maybe...
    Pattern.compile("(?i)<element lev1>*<title>([^<]*)</title>");
    But it seems that things like parsing with SAX (or loading to a DOM) or XPath would be much better suited to parsing out XML then regexp.

  • OO pattern Question

    the Question:
    In the file system, there are many files, their's file format is FormatA.
    and now come two new file formats, FormatB and FormatC.
    Now the old files with file format FormatA should be converted into files with FormatB,and In the future the FormatB maybe convertend into FormatC,
    how to design using design patterns?

    Hi myQA,
    what exactly are you considering the client?
    The one calling readFile and writeFile?
    If you are concerned about explicitly creating FileXReaderWriter
    and thus knowing about the differnt file types, one could easily overcome
    this limitation by using a Factory class:
    public class ReaderWriterFactory {
        public FileReaderWriter createReaderWriter(){
            if (someCondition) { // the condition might be depend on some parameter provided (filename for example) or the state of the system or ...
                 return new FileAReaderWriter();
            } else {
                 return new FileAReaderWriter();
    }If you only need this whole stuff for converting (thus you don't want to read files in order to work with the data inside) you could wrap all
    the logic behind on function call convert(String fromName, String toName) maybe with some additional information what formats to use.
    Although this really belongs in its own class Converter I guess one could add It to the Factory, which then shouldn't be named Factory anymore. If the other classes and Interfaces aren't needed anywhere outside your Converter you should make them private to the converter.
    regards
    Spieler

  • Patterns Question

    Hey everyone, got a question regarding patterns in Illustrator and this one is sorta bugging me.
    Basically, I have a single object, a 3 leaf clover. When I import this object into the swatch pallet, it can make a pattern...yet it is more of a x and y axis pattern (clovers that make 90 degree angles and 180 angles). Is there an easy way to make the clovers pattern everywhere (making 45 degree angles , 90 degree angles, and 180)?
    Thanks in advance for your input. I appreciate it.

    Teri Petit has a sort of tutorial on how to do this do a search for Teri Petit Pattern Fill.

  • Service Locator pattern question.

    Hi,
    We have this kind of service locator which provides the caller a reference to a remote interface instead of to the home interface of the session bean. We're working with weblogic 6.1. My question, is it ok to store a reference to a remote interface in the service locator or is it better to store a reference to the home interface or .... is it better to not store them but every time create one when a client wants one. What is the best way and the pros and cons.
    Cheers!

    Hi,
    typically it is more common to just cache Homes and Factories in the ServiceLocator pattern.
    We have a detailed example of the Service Locator pattern applied in an application at http://java.sun.com/blueprints/patterns/ServiceLocator.html
    We cache the EJB Homes and other Factories.
    http://java.sun.com/blueprints/code/jps131/src/com/sun/j2ee/blueprints/servicelocator/web/ServiceLocator.java.html
    This allows the Service Locator to be used as a utility class. We have a Service Locator used by the web tier, and also one used by the EJB tier to lookup other EJBs and resources.
    hope that helps,
    Sean

  • OSB1G R3 Security Active Intermediary pattern question

    Hi
    we have a requirement to use Message level security (no ssl) between the client and OSB 10gR3 proxy services . No security is required between proxy and business services
    I wnet through WLS and OSB documentation and found it conflicting/vague for setting up the Active intermediary pattern
    we need to do 4 uses cases, Request encryption, Request signing, Response encryption, Response signing
    I have a few questions
    Do we need to setup PKI credential mapper for this (or is this only for outbound between Proxy and business services)
    How do the scenarios logically work (who uses private key and who uses public key for each of these scenarios)
    Current documentation doesnt match with my understanding of PKI infratsructure
    Thanks for any information

    Hi Udi,
    If I am reading your question correctly, you want to know if XI can take the user context from the sharepoint portal and pass it on to the R/3 backend, i.e. logging on to R/3 using the same user as is logged on to sharepoint. The answer, unfortunately, is no. AFAIK the only current way to accomplish this is to include the username in the actual message content and pass this on to the R/3 system; then on the R/3 system code the necessary authority checks against the provided username. Be aware though, that you cannot use the usual authority-check functionality for this.
    Regards,
    Thorsten

  • XSD:Pattern Question

    SQL*Plus: Release 11.2.0.2.0 Production on Thu Jan 13 15:25:04 2011
    Copyright (c) 1982, 2010, Oracle. All rights reserved.
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE 11.2.0.2.0 Production
    TNS for 64-bit Windows: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    I'm putting together a simpler test case for this, but I figured I'd start by asking the question and seeing if the answer is simple...
    I have an XML document with the date elements:
                    <documentDate>20080808</documentDate>
                    <entryDate>2009-09-22</entryDate>the documentDate is defined as PartialDateType.
         <xsd:simpleType name="PartialDateType">
              <xsd:restriction base="xsd:string">
                   <xsd:pattern value="\d{4}|\d{6}|\d{8}"/>
              </xsd:restriction>
         </xsd:simpleType>When I try to validate the document, I get
    “literal "20080808" is not valid with respect to the pattern”.
    If I shorten the date to "2008", the document validates.
    What part of <xsd:pattern value="\d{4}|\d{6}|\d{8}"/> do I not understand?

    Workaround is to reverse the pattern.. See below
    c:\xdb>sqlplus / as sysdba
    SQL*Plus: Release 11.2.0.2.0 Production on Wed Jan 19 13:55:30 2011
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> set echo on
    SQL> spool testcase.log
    SQL> --
    SQL> connect sys/oracle as sysdba
    Connected.
    SQL> --
    SQL> set define on
    SQL> set timing on
    SQL> --
    SQL> def USERNAME = XDBTEST
    SQL> --
    SQL> def PASSWORD = &USERNAME
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user XDBTEST cascade
    User dropped.
    Elapsed: 00:01:40.47
    SQL> grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
      2  /
    old   1: grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
    new   1: grant create any directory, drop any directory, connect, resource, alter session, create view to XDBTEST identified by XDBTEST
    Grant succeeded.
    Elapsed: 00:00:00.08
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user XDBTEST default tablespace USERS temporary tablespace TEMP
    User altered.
    Elapsed: 00:00:00.00
    SQL> set long 100000 pages 0 lines 256 trimspool on timing on
    SQL> --
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> var SCHEMAURL VARCHAR2(700)
    SQL> var XMLSCHEMA CLOB
    SQL> var INSTANCE CLOB
    SQL> --
    SQL> begin
      2    :SCHEMAURL:= 'http://xmlns.example.com/testcase.xsd';
      3    :XMLSCHEMA :=
      4  '<?xml version="1.0" encoding="UTF-8"?>
      5  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
      6     <xs:element name="T1" type="T1_TYPE"/>
      7     <xs:complexType name="T1_TYPE">
      8             <xs:sequence>
      9                     <xs:element name="TEST" type="PartialDateType"/>
    10             </xs:sequence>
    11     </xs:complexType>
    12     <xs:simpleType name="PartialDateType">
    13             <xs:restriction base="xs:string">
    14                     <xs:pattern value="\d{8}|\d{6}|\d{4}"/>
    15             </xs:restriction>
    16     </xs:simpleType>
    17  </xs:schema>';
    18  end;
    19  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> declare
      2    V_XML_SCHEMA xmlType := XMLType(:XMLSCHEMA);
      3  begin
      4    DBMS_XMLSCHEMA.registerSchema
      5    (
      6      SCHEMAURL        => :SCHEMAURL,
      7      SCHEMADOC        => V_XML_SCHEMA,
      8      LOCAL            => TRUE,
      9      GENBEAN          => FALSE,
    10      GENTYPES         => FALSE,
    11      GENTABLES        => FALSE,
    12      ENABLEHIERARCHY  => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE,
    13      OPTIONS          => DBMS_XMLSCHEMA.REGISTER_BINARYXML
    14    );
    15  end;
    16  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:04:26.10
    SQL> create table TEST_TABLE of XMLTYPE
      2  XMLTYPE STORE AS SECUREFILE BINARY XML
      3  XMLSCHEMA "http://xmlns.example.com/testcase.xsd" ELEMENT "T1"
      4  /
    Table created.
    Elapsed: 00:00:00.70
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "9" is not valid with respect to the pattern
    Elapsed: 00:00:06.08
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "99" is not valid with respect to the pattern
    Elapsed: 00:00:06.70
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "999" is not valid with respect to the pattern
    Elapsed: 00:00:07.67
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:24.30
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "99999" is not valid with respect to the pattern
    Elapsed: 00:00:08.02
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:11.60
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999999</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "9999999" is not valid with respect to the pattern
    Elapsed: 00:00:05.60
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:06.18
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999999</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "999999999" is not valid with respect to the pattern
    Elapsed: 00:00:05.61
    SQL> DROP TABLE TEST_TABLE PURGE
      2  /
    Table dropped.
    Elapsed: 00:00:00.14
    SQL> call dbms_xmlSchema.deleteSchema(:SCHEMAURL)
      2  /
    Call completed.
    Elapsed: 00:00:00.06
    SQL> declare
      2    V_XML_SCHEMA xmlType := XMLType(:XMLSCHEMA);
      3  begin
      4    DBMS_XMLSCHEMA.registerSchema
      5    (
      6      SCHEMAURL        => :SCHEMAURL,
      7      SCHEMADOC        => V_XML_SCHEMA,
      8      LOCAL            => TRUE,
      9      GENBEAN          => FALSE,
    10      GENTYPES         => TRUE,
    11      GENTABLES        => FALSE,
    12      ENABLEHIERARCHY  => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    13    );
    14  end;
    15  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.87
    SQL> create table TEST_TABLE of XMLTYPE
      2  XMLTYPE STORE AS OBJECT RELATIONAL
      3  XMLSCHEMA "http://xmlns.example.com/testcase.xsd" ELEMENT "T1"
      4  /
    Table created.
    Elapsed: 00:00:00.07
    SQL> create trigger DO_VALIDATION
      2  before insert
      3  on TEST_TABLE
      4  for each row
      5  begin
      6   :new.object_value.schemavalidate();
      7  end;
      8  /
    Trigger created.
    Elapsed: 00:00:00.06
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "9" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.39
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "99" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.52
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "999" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.50
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:05.95
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "99999" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.53
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:05.40
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999999</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "9999999" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.37
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:05.74
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999999</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "999999999" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.49
    SQL>

  • Needed Latest  SCJP 1.4 exam pattern +question papers

    Hi,
    I'm taking up SCJP 1.4 exam on 13th Oct.
    Could you please suggest websites for/ send the Latest SCJP 1.4 exam pattern and question papers for me ?
    Thanks and Regards,
    Sanjeev Kulkarni

    Darryl.Burke wrote:
    From the UK:
    Durham University's page on SLAC-HEPNAMES database of EMAIL-IDs in HEPDATA
    {color:#0000ff}http://durpdg.dur.ac.uk/HEPDATA/ID{color}That line is only in the title. The text says
    worldwide directory of email addresses
    >
    From the US:
    University of California's page on Mail ID Name Changes
    {color:#0000ff}http://email.ucdavis.edu/forms/mailidnamechange.php{color}They use MailID (not email id, is an internal identifier) and the text says
    change in your email address then after your old email address expires
    >
    >
    University of North Carolina's page on UNCW E-mail ID Retrieval
    {color:#0000ff}https://appserv02.uncw.edu/dasapps/sec/getid.aspx{color}Once again, Email-ID is again an internal term refering to the use of an email address as a logon id.
    The text, once again, says
    UNCW e-mail username (your e-mail address without the @uncw.edu)
    >
    From Belgium:
    Username: (Email ID) on
    {color:#0000ff}http://customer.netline.be/{color}
    Once again, I see this more as simply an internal reference to an email used as a logon id (so a composite term).
    Madison Area Technical College's page on Student Network/Email ID Choices
    {color:#0000ff}http://matcmadison.edu/matc/studentresources/studentemail/about.shtm{color}
    From page
    {color:#0000ff}http://www.abitmore.be/ssr2001/w3warecb.htm{color}
    ... ... like: change in eMail ID, ... ...
    These site seems to be using like you feel (although the first does not contain enough context to be sure), but they, and every other site listed here, is hardly definative.
    Edit: This is not to be combative, so please don't take it that way. Just expanding on my viewpoint.
    ;-)

Maybe you are looking for

  • Sales order cost objective vs OKB9  Internal order cost object.

    Hi All, we facing an  issue with sales order cost objective vs OKB9 cost object. For IC PO service material, we assigned account assignment category 4.Reasonis Service material was not showing on G\R account. The G\L account 7898788, we assigned to S

  • Flash9 player HELL

    Hi all, I installed flash player 9 and ofcourse it didnt work. the plugin works fine but the activx control refuses. When i rightclick on a movie the context menu says (greyed out) 'movie not loaded'... enough allready this takes up too much of my ti

  • I can't update my ipod 2g from 3.1.3 to 4.2.1. HELP PLEASE

    Hi,      I just got my ipod touch 2g replaced and it is still on 3.1.3 and i plugged it into itunes and it says to upgrade to 4.2.1 so i click ok. But when it reaches the validating update with apple part it says : "Cannot update ipod. uknown error (

  • Fitting into the Text boxes

    HI I am trying to fill out an application on Adobe Reader and some of the spaces are a bit short and do not allow me to competely answer the questions.  Is there a way to either reduce font ot create 2 lines within the text box to allow for more spac

  • Open LR 6 freestanding and Lightroom CC appears

    I purchased LR 6 upgrade for my stand alone LR 5.7.  When I open LR 6, the initial opening panel is Lightroom creative cloud. The upper left of the Lightroom screen also says Lightroom CC 2015. I do have Adobe CC also on the computer purchased throug