How to group result set to count values in several (2) attributes?

Hi there,
the (simplified) query at the bottom returns the following result set:
OBJ_ID Attr 1 Attr2
22674886 HAK44221 GEB132542
22674886 HAK44221 GEB92751
22674886     HAK44222 GEB92744
22674886     HAK17113 null
However, we need the number of different Attr 1 and Attr2 counted, which should result in the this:
OBJ_ID Attr 1 Attr2
22674886 3 3
We trried using "group by grouping sets", "group by" and also took a glance at "cube" but didn't manage to get the desired result, mainly due to the fact, that Attr2 may contain null values.
We managed to find a solution using a GTT or a view. Can anybody give a hint how to solve that without using temporary tables?
Best regards
Pat
SELECT
o.obj_id,
o2.obj_name as Attr1,
g.ckw_nis_nummer as Attr2
FROM objekte o
JOIN eigenschaftsdaten d0
ON (o.obj_id = d0.obj_id AND d0.eig_id = 2525755)
LEFT JOIN eigenschaftsdaten d8
ON (d0.egd_wert=substr(d8.egd_wert,1,instr(d8.egd_wert, ' ')-1) and d8.eig_id=2525976)
LEFT JOIN objekte o2
ON o2.obj_id=d8.obj_id
LEFT join gebaeude g
ON o2.obj_id=g.parent_house_service

Hi,
That looks like COUNT (DISTINCT ...):
SELECT       o.obj_id
,       COUNT (DISTINCT o.obj_name)          AS attr1
,       COUNT (DISTINCT g.ckw_nis_nummer)     AS attr2
FROM        objekte o
JOIN        eigenschaftsdaten     d0     ON   o.obj_id      = d0.obj_id
                           AND  d0.eig_id       = 2525755
LEFT JOIN eigenschaftsdaten      d8     ON   d0.egd_wert = SUBSTR ( d8.egd_wert
                                                         , 1
                                          , INSTR (d8.egd_wert, ' ') - 1
                         and d8.eig_id=2525976)
LEFT JOIN objekte          o2     ON  o2.obj_id      = d8.obj_id
LEFT JOIN gebaeude           g     ON  o2.obj_id      = g.parent_house_service
Depending on your data and your requirements, you may need to join some of the tables separatemly, do a GROUP BY to get attr2, and then join those results to the other tables.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data. WSimplify the problem as much as possible. For exam[ple, if your real problem involves 5 tables, but the part you don't understand can be shown with only 1 or 2 tables, then post sample data and results for those 1 or 2 tables only.
Point out where the query above is getting the wrong results, and explain, using specific examples, how you get those results from the sample data in those places.
Always say what version of Oracle you're using.
See the forum FAQ {message:id=9360002}

Similar Messages

  • How to determine how many times result set columns have same value

    Hi -
    I'm doing a report which will be used for payment trend analyses.
    My initial result set looks like this:
    HOUSEHOLD_ID     JAN_PMT     FEB_PMT     MAR_PMT     APR_PMT     MAY_PMT     JUN_PMT     JUL_PMT     AUG_PMT     SEP_PMT     OCT_PMT     NOV_PMT     DEC_PMT
    90026845409     1     1     1     1     2     1     1     1     1     0     1     0(many rows, of course; result set pivoted)
    I need to determine the households that have a > 0 value in three or more consecutive months.
    I'm hoping someone will have some suggestions because the only solutions I'm coming up with right now would be a coding nightmare (lots of "OR's"), and I'm assuming (hoping) there's a better solution out there.
    Thanks!
    Christine

    Hi Frank,
    I'm not sure I'm understanding how I would use those analytic functions. Here is my select statement:
    SELECT HOUSEHOLD_ID,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  1 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  1 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS JAN_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  2 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  2 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS FEB_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  3 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  3 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS MAR_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  4 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  4 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS APR_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  5 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  5 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS MAY_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  6 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  6 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS JUN_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  7 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  7 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS JUL_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  8 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  8 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS AUG_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  9 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  9 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS SEP_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     = 10 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 = 10 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS OCT_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     = 11 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 = 11 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS NOV_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     = 12 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 = 12 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS DEC_PMT
      FROM MONETARY_TRANS
    WHERE MONETARY_TRANS_TYPE_ID    = 1                             --payment
    --TESTING
    AND HOUSEHOLD_ID = 90026845409
       AND RESPONSIBLE_PARTY_TYPE_ID = 1                             --household
       AND RECEIVED_DATE > '01-JAN-2008'
       AND ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6
        OR   TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 )
       AND PREMIUM_AMOUNT            > 0
       AND BILLING_TRANS_TYPE_ID     = 6
       AND MONETARY_TRANS_TYPE_ID    = 1
       AND RESPONSIBLE_PARTY_TYPE_ID = 1
    GROUP BY HOUSEHOLD_IDAnd from this I get the results originally posted. From there I need to figure out the households that have values greater than 0 for three or more consecutive months.
    Thanks for your help........
    -Christine

  • How to display result set boolean value as a check box

    Hi guys,
    I am getting the data which include boolean from the database, i need to display the boolean values as check box, see my code, its displaying the data into the table with the boolean values as true and false, how to make it in check boxes
    package swing2.org;
    import java.awt.GridBagLayout;
    import javax.swing.JPanel;
    import java.awt.Color;
    import javax.swing.BorderFactory;
    import javax.swing.border.BevelBorder;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import java.awt.Container;
    import java.awt.GridBagConstraints;
    import java.awt.ComponentOrientation;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.ArrayList;
    public class Panel2 extends JPanel {
         private static final long serialVersionUID = 1L;
         private JScrollPane jScrollPane = null;
         private JTable jTable = null;
          * This is the default constructor
         public Panel2() {
              super();
              initialize();
          * This method initializes this
          * @return void
         private void initialize() {
         //     Panel2.ResultSetFrame();
              GridBagConstraints gridBagConstraints = new GridBagConstraints();
              gridBagConstraints.fill = GridBagConstraints.BOTH;
              gridBagConstraints.gridy = 0;
              gridBagConstraints.weightx = 1.0;
              gridBagConstraints.weighty = 1.0;
              gridBagConstraints.gridx = 0;
              this.setSize(340, 200);
              this.setLayout(new GridBagLayout());
              this.setBackground(new Color(171, 211, 224));
              this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED), null));
              this.add(getJScrollPane(), gridBagConstraints);
          * This method initializes jScrollPane     
          * @return javax.swing.JScrollPane     
         private JScrollPane getJScrollPane() {
              if (jScrollPane == null) {
                   jScrollPane = new JScrollPane();
                   jScrollPane.setViewportView(getJTable());
              return jScrollPane;
          String[] columnNames = {"Task Description",
                 "Time ",
                 "Pop-up",
                 "Sound",
                 "Delete"};
          * This method initializes jTable     
          * @return javax.swing.JTable     
         private JTable getJTable() {
                      ResultSetFrame oo = new ResultSetFrame();
                      JTable table = new JTable(oo.model);
                      table.setBackground(new Color(195, 217, 230));
                      table.setComponentOrientation(ComponentOrientation.UNKNOWN);
                      table.setShowGrid(true);
                      table.setShowVerticalLines(true);
                      table.setRowHeight(17);
                      table.setShowHorizontalLines(true);
                      return table;
    abstract class ResultSetTableModel extends AbstractTableModel
         public ResultSetTableModel(ResultSet aResultSet)
              rs = aResultSet;
          try
               rsmd = rs.getMetaData();     
          catch(SQLException e)
               System.out.println("Error " + e);
       public String getColumnName(int c)
       {  try
          {  return rsmd.getColumnName(c + 1);
          catch(SQLException e)
          {  System.out.println("Error " + e);
             return "";
       public int getColumnCount()
       {  try
          {  return rsmd.getColumnCount();
          catch(SQLException e)
          {  System.out.println("Error " + e);
             return 0;
       protected ResultSet getResultSet()
       {  return rs;
       private ResultSet rs;
       private ResultSetMetaData rsmd;
    class CachingResultSetTableModel extends ResultSetTableModel
    {  public CachingResultSetTableModel(ResultSet aResultSet)
       {  super(aResultSet);
          try
          {  cache = new ArrayList();
             int cols = getColumnCount();
             ResultSet rs = getResultSet();
             /* place all data in an array list of Object[] arrays
                We don't use an Object[][] because we don't know
                how many rows are in the result set
             while (rs.next())
             {  Object[] row = new Object[cols];
                for (int j = 0; j < row.length; j++)
                   row[j] = rs.getObject(j + 1);
                cache.add(row);
          catch(SQLException e)
          {  System.out.println("Error " + e);
       public Object getValueAt(int r, int c)
       {  if (r < cache.size())
             return ((Object[])cache.get(r))[c];
          else
             return null;
       public int getRowCount()
       {  return cache.size();
       private ArrayList cache;
    class ResultSetFrame 
    {  public ResultSetFrame()
          /* find all tables in the database and add them to
             a combo box
          try
          {  Class.forName("com.mysql.jdbc.Driver");
             con = DriverManager.getConnection("jdbc:mysql://localhost:3306/task","root","nbuser");
                stmt = con.prepareStatement("SELECT * FROM tasky");
                   try
                    String query = "SELECT * FROM tasky";
                    rs = stmt.executeQuery(query);
                    model = new CachingResultSetTableModel(rs);
                    JTable table = new JTable(model);
                    scrollPane = new JScrollPane(table);
                catch(SQLException e)
                     System.out.println("Error " + e);
          catch(ClassNotFoundException e)
          {  System.out.println("Error " + e);
          catch(SQLException e)
          {  System.out.println("Error " + e);
       private JScrollPane scrollPane;
       public ResultSetTableModel model;
       private ResultSet rs;
       private Connection con;
       private Statement stmt;
    }

    add a
    public Class getColumnClass(int col) {
         return getValueAt(0, col).getClass();
    }in your ResultSetTableModel which extends AbstractTableModel.
    A simple example
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.SwingUtilities;
    import javax.swing.table.AbstractTableModel;
    public class SimpleDemo extends JFrame {
        public SimpleDemo() {
            createAndShowUI();
        private void createAndShowUI(){
            String[] columnName = {"CheckBox Column", "Data Column"};
            Object[][] data = {{new Boolean(true), "Data 1"},
            {new Boolean(false), "Data 2"}, {new Boolean(true), "Data 3"}};
            MyModel model = new MyModel();
            model.setData(columnName, data);
            JTable myTable = new JTable(model);
            JScrollPane scrollPane = new JScrollPane(myTable);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            getContentPane().add(scrollPane);
            pack();
            setLocationRelativeTo(null);
        class MyModel extends AbstractTableModel {
            String[] columnName;
            Object[][] data;
            public void setData(String[] colName, Object[][] theData) {
                this.columnName = colName;
                this.data = theData;
                fireTableStructureChanged();
            public String getColumnName(int column) {
                return columnName[column];
            public Object getValueAt(int rowIndex, int columnIndex) {
                return data[rowIndex][columnIndex];
            public int getRowCount() {
                return data.length;
            public int getColumnCount() {
                return columnName.length;
            public Class getColumnClass(int c) {
                return getValueAt(0, c).getClass();
        public static void main(String[] args){
            Runnable run = new Runnable(){
                public void run(){
                    new SimpleDemo().setVisible(true);
            SwingUtilities.invokeLater(run);
    }

  • Grouping result set by a column in a query without aggregate function

    In the below result set, several columns appear for one table.
    col data_Type format a12
    col column_name format a10
    set lines 100
    set pages 50
    SELECT table_name, column_name FROM user_tab_cols WHERE char_used = 'B'
    AND TABLE_name NOT LIKE 'BIN%' ORDER BY TABLE_NAME;
    TABLE_NAME                     COLUMN_NAM
    BONUS                          JOB
    BONUS                          ENAME
    DEPT                           DNAME
    DEPT                           LOC
    EMP                            JOB
    EMP                            ENAME
    EMP_DTL                        ENAME
    EMP_DTL                        LOC
    EMP_DTL                        CONVN_LOC
    MEMBER                         GENDER
    MEMBER                         TEAM
    MEMBER                         MEMBERTYPE
    MEMBER                         FIRSTNAME
    MEMBER                         LASTNAME
    MEMBER                         PHONE
    ORDERS                         STATUS
    SYS_CONFIG                     CODE_ID
    SYS_CONFIG                     FLAG_A
    TOURNAMENT                     TOURTYPE
    TOURNAMENT                     TOURNAMEI don't want the table_name to repeat for every columns within a table_name group. If i use SQLPLUS's BREAK command, it would
    suppress duplicates
    break on table_nameand the resultset would look like
    TABLE_NAME                     COLUMN_NAM
    BONUS                          JOB
                                   ENAME
    DEPT                           DNAME
                                   LOC
    EMP                            JOB
                                   ENAME
    EMP_DTL                        ENAME
                                   LOC
                                   CONVN_LOC
    MEMBER                         GENDER
                                   TEAM
                                   MEMBERTYPE
                                   FIRSTNAME
                                   LASTNAME
                                   PHONE
    ORDERS                         STATUS
    SYS_CONFIG                     CODE_ID
                                   FLAG_A
    TOURNAMENT                     TOURTYPE
                                   TOURNAME
    TYPE                           TYPE
    X                              ENAME
    Y                              ENAMEBut how can i do this using oracle SQL?

    Analytics?
    SQL> with t as
      2  (
      3  select 'A' col1, 100 col2 from dual
      4  union all
      5  select 'A' col1, 200 col2 from dual
      6  union all
      7  select 'B' col1, 800 col2 from dual
      8  union all
      9  select 'B' col1, 400 col2 from dual
    10  union all
    11  select 'C' col1, 500 col2 from dual
    12  )
    13  select decode(row_number() over (partition by col1 order by col2), 1, col1, null) col1
    14         ,col2
    15  from t
    16  /
    C      COL2
    A    100.00
         200.00
    B    400.00
         800.00
    C    500.00
    SQL>Cheers
    Sarma.

  • How to highlight result set data on world map

    Hi,
    I want to show the graphical representation of world map to highlight the countries which having the maximum booking of hotels of our client xyz.
    All the values are coming from the mysql db .
    I want the library which will draw the world map on the Jpanel for the respective result set
    Plz help me for this .
    I generally use the JFreeChart for drawing the other graphs but the Jfreechart don't have the library for the World Map or Destination Graph etc.
    Hint: ( Google Analytic's map is the best example )
    Thanks In Advanced
    Mahesh

    This isn't what you want, but it will get you on the right track. I chose the most complex image I could find so give it a few seconds to read the image and build the paths. The parser is catered to the image I chose, but in general you can probably expect the "path" element to delineate the boundaries for any map svg. The particular image I chose grouped the paths with country ID so I added a little mouse interaction to the GUI. Forgive me for any dumbly coded stuff. I didn't put much effort into streamlining it.
    import org.xml.sax.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import org.xml.sax.helpers.DefaultHandler;
    import java.awt.geom.Path2D;
    import java.util.StringTokenizer;
    import java.net.URL;
    public class WorldMapTest {
        public static void main(String[] args) throws Exception {
            SAXParserFactory factory = SAXParserFactory.newInstance();
            SAXParser saxParser = factory.newSAXParser();
            SimpletonPathExtractor handler = new SimpletonPathExtractor();
            saxParser.parse(new URL("http://upload.wikimedia.org/wikipedia/commons/b/b7/World98.svg").openStream(), handler);
            createAndShowGUI(handler.locations);
        public static void createAndShowGUI(final java.util.List<Location> locations) {
            JFrame frame = new JFrame();
            JPanel p = new JPanel() {
                @Override
                public Color getBackground() {
                    return Color.white;
                public void paintComponent(java.awt.Graphics g) {
                    super.paintComponent(g);
                    Graphics2D g2 = (Graphics2D) g;
                    g2.scale(getWidth() / 8000.0, getHeight() / 3859.0);
                    g2.setColor(Color.black);
                    Point p = getMousePosition();
                    if(p != null) {
                        p.x = (int) (p.x * 8000/getWidth());
                        p.y = (int) (p.y * 3859/getHeight());
                    String placeID = null;
                    for (Location loc : locations) {
                        if(p != null && placeID == null && loc.boundry.contains(p)){
                            g2.setColor(Color.LIGHT_GRAY);
                            g2.fill(loc.boundry);
                            placeID = loc.id == null?"Unkown":loc.id;
                            g2.setColor(Color.black);
                        g2.draw(loc.boundry);
                    if (placeID != null) {
                        g2.setColor(Color.green.darker());
                        Font f = g2.getFont();
                        f = f.deriveFont(Font.BOLD,(f.getSize() * 8000f / getWidth()));
                        g2.setFont(f);
                        g2.drawString(placeID, p.x, p.y);
                public java.awt.Dimension getPreferredSize() {
                    return new Dimension(1000,482);
            p.addMouseMotionListener(new java.awt.event.MouseAdapter() {
                @Override
                public void mouseMoved(java.awt.event.MouseEvent e) {
                    ((JComponent) e.getSource()).repaint();
            frame.setContentPane(new JScrollPane(p));
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
        public static class SimpletonPathExtractor extends DefaultHandler {
            java.util.List<Location> locations = new java.util.ArrayList<>();
            String recentID;
            @Override
            public void startElement(String uri, String localName, String qName, Attributes attr) throws SAXException {
                if("g".equals(qName)) {
                    recentID = attr.getValue("id");
                if ("path".equals(qName)) {
                    int length = attr.getLength();
                    for (int i = 0; i < length; i++) {
                        String attrN = attr.getQName(i);
                        String val = attr.getValue(attrN);
                        if ("d".equals(attrN)) { //path data
                            Path2D path = new Path2D.Double();
                            //assume simple polygonal path
                            StringTokenizer tk = new StringTokenizer(val, "MLzZ ");
                            try {
                                path.moveTo(Double.parseDouble(tk.nextToken()),
                                            Double.parseDouble(tk.nextToken()));
                                while (tk.hasMoreTokens()) {
                                    path.lineTo(Double.parseDouble(tk.nextToken()),
                                                Double.parseDouble(tk.nextToken()));
                                path.closePath();
                            } catch (Exception e) {
                                throw new Error("I'm a simple parser. I can only do "
                                        + "'LineTo' paths!", e);
                            locations.add(new Location(path,recentID));;
            public void endElement(String uri, String localName, String qName) throws SAXException {
                if("g".equals(qName)) {
                    recentID = null;
        public static class Location {
            Path2D boundry;
            String id;
            public Location(Path2D boundry, String id) {
                this.boundry = boundry; this.id = id;
    }

  • JDBC- RFC - JDBC    How to send result set to rfc  ?

    Hi Friends ,
                        I am working on scenario like .
              <b>          I have to read  data from a sql server using select statement and send same   data  to r3 ( using RFC  we are inserting the same as  a copy ) .
                        Then i have have get confirmation from R3 as data inserted succesfully  - Flag  .Then we have to come back to same table and update one field  flag as 'U'.</b>
                      For this I am using JDBC Sender Adapter and RFC Receiver Adapter .Will i use  as Synchronous  Interface ?
                      I think i have to use JDBC  Receiver Adapter    also to Complete the cycle .
                      Can you please clarify  the following....
                       1. how is that whole selected data will send to R3 . If i use Select statement in JDBC Sender Adapter  it will as resultset  .It will contain Multiple Rows right ?  Our RFC Will accept the parameter as string .
                        2. If we use the synchronous Interface will it send row by row from the result send Then  get back the result from R3 and come back again to JDBC ( Database ) and  update the required field ?
                        3. In JDBC Sender Adapter , the Update Parameter doing the Updation  Part  prior to get the status from R3. How to handle this ?
                       4. Do i need to configur teh separate JDBC Receiver adpater for this updation part ? Then We cann't use Synchronous Interface right ?
                     5 . Will JDCB Sender  Adapter get the result set (by select statement )  and send to r3 as row by row and get the confirmation message as inserted  ?
    Best Regards .,
    V.Rangarajan

    Hi Udo ,
                   Thanks for your reply . If i have used the synchronnous RFC Calls  , that RFC will return the flag as 'Y' or 'N'  , for  Either succesfully inserted or Not successful .
                      In this synchronous  how can i use the JDBC Receiver adapter ?
                     If 'Y'  or 'N' I have to update the<b> same table ,same row</b> which have sent to RFC .  My doubt , we are  wrirtng the  SQL  select query as  "  <b>select * from table  name where UpdateStatus is null</b> " .
                     So it will return multiple rows right ?   I have to uses the synchronous response form RFC to update the row of the  same table using JDBC Adapter right ?
                   Can you please explain me little bit more ? I am new to xi .
    Best Regards .,
    V.Rangarajan

  • How to export result set from mysql query browser to .sql in oracle

    Hi folks:
    I was trying to export result set from MySql query browser to Oracle. I could able to do
    File->Export Result Set-> Excel format...
    What I am trying to get is .sql file so that I can run it as a script in my oracle db. Is there any way we can get .sql file with inserts and delimeters ....?
    Did you guys get my question.?
    Please throw some light on this....
    Could be very appreciable ....
    Thanks
    Sudhir Naidu

    Hi
    Create a sql statement which generates the insert statements.
    Something like this:
    select 'insert into table1 (column1, column2, column3) values (' ||
    column1 || ', ' || column2 || ', ' || column3 || ');' from table 1;
    The || sign is the string concatenation sign in Oracle, replace it the appropriate sign in MySql. Export the result set of this query into a file, and you can run it in a SqlPlus.
    Ott Karesz
    http://www.trendo-kft.hu

  • How dynamically genrate result set in OBIEE 11.

    I have variable in OBIEE 11 dashboard report that contains a comma separated string
    represented by Fact table columns as below are 3 columns of Fact table Unique Clicks, No of Prospects,
    and Email Sent Count
    Var = “Fact”.”Unique Clicks”,”Fact”.”No of Prospects”,”Fact”.”Email Sent Count”
    Now I want to separate these columns and generate columns of result set in OBIEE 11 dashboard report
    In other word dynamically generate result set columns.
    Can I do through java script, changes in analysis XML shown in Advanced tab etc any syggestion.

    Hi Radha,
    If you want to cache the results in the Oracle BI Server, you should check that option. When you run a query the Oracle BI Server will get its results from the cache, based on the persistence time you define. If the cache is expired, the Oracle BI Server will go to the database to get the results.
    If you want to use caching, you should enable caching in the nqsconfig.ini file.
    Cheers,
    Daan Bakboord

  • How to display results set of multiple reports into a single report table

    Our goal is to create a single report (or dashboard) that shows the "funnel" of object creations related to each campaign. The flow goes from Activity to Lead to Opportunity as well as multiple steps within each (ie. Unqualified Lead -> Qualified Lead, etc).
    We currently have 3 separate reports in three different subject areas, each reporting the different metrics and we would like to combine the output into a single Unified report.
    For example what we currently have is:
    Activities:
    Campaign Name # of Activities
    Campaign A 12
    Campaign B 26
    Leads:
    Campaign Name # of Leads # of Qualified Leads
    Campaign A 10 4
    Campaign B 20 18
    Opportunities:
    Campaign Name # of Opportunities # of Opps per Sales Stage ... # of Wins Closed Revenue
    Campaign A 3 2 1 $1,000.00
    Campaign B 10 8 3 $2,800.00
    What we want to see is:
    Combined:
    Campaign Name - Campaign Cost - # of Activities - # of Leads - # of Qualified Leads - # of Opportunities - # of Opps per Sales Stage - # of Wins - Closed Revenue
    Campaign A - $423.00 - 12 - 10 - 4 - 3 - 2 - 1 - $1,000.00
    Campaign B - $ 1,000.00 - 26 - 20 - 18 - 10 - 8 - 3 - $2,800.00
    We have tried using the "Combine with similar analysis" but the number of columns for each subject area differ. We also tried creating multiple UNION criteria (one for each column), but in the case of # of Opps per Sales Stage and Closed Revenue, those are not "Metrics" fields, so they won't combine.

    Hi, You may have to create some dummy fields to equate the no. of field in each of the report matching the data type too and get a one single report using combined analytics and then using the resultant data you can create a simple pivot like below. Haven't tried it before
    -- Venky CRMIT
    Hi Venky,
    I am facing the same problem. Can you please say Steps how to create resultant data and Combine in pivot Table .
    Please Help me .
    Thanks in Advance .
    My mail id is :
    [email protected]

  • How to get seeburger work bench counter value

    hi all,
    i want to get the current counter value in the seeburger workbech counter.
    i used the following function suggested in one of the threads in forum, but its giving the below error
    func used:
    try {
    VariableBean be=VariableFactory.getVariableInstance("");
    return be.getStringVariable(variableName);
    } catch (Exception e) {
    throw new RuntimeException(e);
    error:
    RuntimeException in Message-Mapping transformation: Exception:[java.lang.RuntimeException: java.lang.RuntimeException: VariableBeanServlet: Could not call getVariable() method of the Servlet. Cause=java.lang.ClassCastException]
    i guess this above function is to get variable value and not counter value. can any body give me code to get counter value.
    Thanks a lot in addvance
    Regards,
    Rashmi
    Edited by: Rashmi H S on Aug 12, 2009 2:30 PM

    use getCounter
       //write your code here
    try {
    CounterBean be=CounterFactory.getCounterInstance();
    return ""be.getCounter("counterName_"b"_"a );
    } catch (Exception e) { 
        throw new RuntimeException(e.getMessage()); 
    will return the same counter what you have ,I also had same scenario what you are facing recently
    HTH
    Rajesh
    Edited by: Rajesh on Aug 13, 2009 7:49 PM

  • MDX - How to group results to calculate the average

    Hi,
    I have the following MDX query which selects total unique visits per day between a range of my choosing:
    WITH MEMBER [Measures].[MyAvg] AS
    Round( AVG(
    EXCEPT([Dim Date].[Day Of Week].Members,
    {[Dim Date].[Day Of Week].[All].&[1],[Dim Date].[Day Of Week].[All].&[7],[Dim Date].[Day Of Week].[All].UNKNOWNMEMBER}
    ), [Measures].[UniqueVisitsDay]
    ), 2)
    SELECT { [Measures].[MyAvg] } ON COLUMNS,
    NON EMPTY { [Dim Date].[Year Month Date].[PK Date].&[2013-03-01T00:00:00]:[Dim Date].[Year Month Date].[PK Date].&[2013-03-31T00:00:00] } ON ROWS
    FROM
    [MyCube];
    Which gives me the following results:
    01/03/2013 634
    02/03/2013 16
    03/03/2013 19
    04/03/2013 698
    05/03/2013 704
    06/03/2013 692
    07/03/2013 774
    08/03/2013 755
    09/03/2013 9399
    10/03/2013 19990
    11/03/2013 775
    12/03/2013 835
    13/03/2013 868
    14/03/2013 900
    15/03/2013 844
    17/03/2013 19
    18/03/2013 248
    19/03/2013 920
    20/03/2013 958
    21/03/2013 1092
    22/03/2013 798
    23/03/2013 21
    24/03/2013 10
    25/03/2013 731
    26/03/2013 770
    27/03/2013 537
    28/03/2013 300
    29/03/2013 28
    30/03/2013 8
    31/03/2013 4
    What I need to do is get the average of this set of results over the month.  I am expecting this answer:
    1478.233333 (which is total unique hits - 44347 / total rows - 30)
    But when I change my MDX code to this:
    WITH MEMBER [Measures].[MyAvg] AS
    Round( AVG(
    EXCEPT([Dim Date].[Day Of Week].Members,
    {[Dim Date].[Day Of Week].[All].&[1],[Dim Date].[Day Of Week].[All].&[7],[Dim Date].[Day Of Week].[All].UNKNOWNMEMBER}
    ), [Measures].[UniqueVisitsDay]
    ), 2)
    SELECT { [Measures].[MyAvg] } ON COLUMNS,
    NON EMPTY { [Dim Date].[Year Month].[Mar 2013]:[Dim Date].[Year Month].[Mar 2013] } ON ROWS
    FROM
    [MyCube];
    I get the following result:
    MyAvg
    Mar 2013 9868
    Actual: 9868  
    Expected: 1478.233333
    What am I doing wrong?
    Thanks,
    Rob

    Hi Rob,
    In SQL Server Analysis Serviceswe do not have a measure Average aggregation type. Fortunately, we have Sum and Count, and since Average = Sum / Count, we can build our own Average aggregation when we need one. Here is a blog about how to create a average
    measure, please refer to the link below.
    Average Aggregation in Analysis Services
    Regards,
    Charlie Liao
    TechNet Community Support

  • How to get "Result Filtering Expression" Selected Value in my Sequence?

    Hello
    I need to implement a conditional statement(? in an expression for one of my step in a sequence.
    This conditional statement would be checking "Result Filtering Expression" value set earlier in "Report options".
    It will be helpful if i can get this "Result Filtering Expression" value by some property which i can check in my conditional statement.
    Regards
    Nitin Goel

    Ben,
    i doubt that this will work out the way you are looking for. There is maybe only one way to accomplish that: On the fly reporting.
    Further, please note that some XML reportformats does not honor that setting, so you have to use one of the other reportformats.
    The main reason that only on the fly reporting possibly could supply you with the desired functionality is, that TS collects the results in the ResultList and after the whole execution of your MainSequence (including all its subs!) is finished, the processmodell creates the report. And in this step, it does not matter, how often and when you changed the filtersettings. It will only honor the last setting and this will be applied to the whole report.....
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • How to get result set

    Hi all,
    Please tell me how to get the below required out put.
    this is my table and data
    with t as (select 11 plcy,1 nm from dual union all
    select 11 plcy,2 nm from dual union all
    select 11 plcy,3 nm from dual union all
    select 11 plcy,5 nm from dual union all
    select 22 plcy,1 nm from dual union all
    select 22 plcy,2 nm from dual union all
    select 22 plcy,3 nm from dual union all
    select 33 plcy,1 nm from dual union all
    select 44 plcy,2 nm from dual union all
    select 55 plcy,4 nm from dual union all
    select 66 plcy,3 nm from dual )
    select * from t
    this my required output.
    from above query required output is below
    plcy      nm
    11      5
    33      1
    44      2
    55      4
    66      3
    if pass nm = 5 then 11
    if i pass nm= 1 then 33
    if i pass nm=2 then 44
    if pass nm = 4 then 55
    if i pass nm =3 thne 66
    it means it has only one value from plcy
    11 5
    33 1
    44 2
    55 4
    66 3
    thanks,

    Something like this:
    SQL > with t as (select 11 plcy,1 nm from dual union all
      2             select 11 plcy,2 nm from dual union all
      3             select 11 plcy,3 nm from dual union all
      4             select 11 plcy,5 nm from dual union all
      5             select 22 plcy,1 nm from dual union all
      6             select 22 plcy,2 nm from dual union all
      7             select 22 plcy,3 nm from dual union all
      8             select 33 plcy,1 nm from dual union all
      9             select 44 plcy,2 nm from dual union all
    10             select 55 plcy,4 nm from dual union all
    11             select 66 plcy,3 nm from dual
    12  )
    13  SELECT     MAX(plcy) plcy
    14  ,  NM
    15  FROM       t
    16  GROUP BY NM
    17  ORDER BY PLCY
    18  /
          PLCY         NM
            11          5
            33          1
            44          2
            55          4
            66          3

  • How do I format based on the value of the @status attribute?

    Example: I use the @status attribute to indicate that a step in a procedure is new or that a paragraph in a concept is new.
    For review purposes, I want to format new text as green - preferably a green highlight, but green text will do.
    Example: I use the @status attribute to indicate that a step in a procedure has been deleted or that a paragraph in a concept has been deleted.
    For review purposes, I want to format new text as crossed out.
    Can this be done? If so, where do I set up the formatting for attribute values?
    Thanks in advance.
    Marsha

    Hi Marsha,
    If you want the formatting to be "locked in," that is, driven by the EDD, then Lynne's advice is the way to go. If instead it would be sufficient to temporarily color the desired elements as a format override, you could use the AXCM plugin:
    http://www.weststreetconsulting.com/WSC_AXCM.htm
    This plugin can do any nature of coloring, strikethrough, etc. based on attribute values and other markup. The coloring is applied as a format override and easily removed by a refresh of the EDD. The coloring features were mainly designed for conditional text purposes, but it would work in this case too.
    AXCM is completely free. Disclaimer... I own West Street Consulting and this plugin.
    Russ

  • How to set a default value of " " for a VARCHAR2 in ER diagram?

    Hi,
    I am trying to set the default value of a VARCHAR2 attribute to " " (space) in an ER diagram. But it just thinks I don't want anything for the default value. If I specify CHR(32) will it work? or is there another way? Will I have to wait until I get into the server model to do this, if so how do I do it there?
    thx
    adam

    Are you sure you want the default to be a space, not a NULL? VARCHAR2 fields want to trim spaces from the right, which makes them NULL if they started as all spaces. You can force them to accept spaces, but it is an unnatural condition. Even the VARCHAR2 columns that I use as surrogates for booleans I set as 'Y' for true and 'N' for false, or 'T' for true and 'F' for false. Occasionally, it will be 'X' for selected and NULL for not selected, but the NULLs tend to cause trouble so I avoid them.
    Okay, let's assume that you have a good reason to default to a space. Use ' ', including the single quotes. When you transform to a Table Definition, change the Default Value Type for the column to a Database Function Call. You can't do that in the logical (Entity/Attribute) design, only in the physical (Table/Column). That will make sure that the Server generator will leave it the way you wrote it.

Maybe you are looking for

  • Error in PDF

    Hi All, I am facing a problem in one of my PDF forms in WebDynpro. I have 2 subforms (one set as a Table and another as Western Text to display n records by looping the Node) which contains an Input field for displaying a value in my PDF form. But th

  • I cant open an iclude account. they wrote the maximum number of free accounts have been activated on this iphone.

    i bought my iphone from someone, then i created apple id, i forgot the password...and created a new one now i want to creat iCLOUD with my last apple id and it wrote the maximum number of free accounts have been activated on this iphone. what can i d

  • How to provide a button in bsp that downloads data from SAP into powerpoint

    hi, how to provide a button in bsp that downloads data from SAP into powerpoint this absurd requirement is needed by my client. thanks saad

  • How do i measure frequency?

    lets say theres this signal in volts. if you plot the signal it forms a sine graph. is there any way to use labview to determine the frequency of the signal? i've tried to use the "measure frequency vi" but my device is connected to a virtual channel

  • Windows 7 Pro will not restart if printer on.

    Hello, When clicking restart, Windows 7 Pro will not restart with either hp printer (L7680 or C309a) powered on.  The screen just stays on 'Starting Windows'.  Windows will continue to load after powering down which ever printer is powered on. This p