OCI8 OCIBindDynamic failure to callback on random columns over multiple rows
I am developing a set of bindings to Oracle for Python; see http://www.zope.org/Members/matt/dco2
When attempting to implement Python's executemany() method of the Python DB API, the code sets up a set of columns which are marked as DATA_AT_EXEC when bound, and a subsequent OCIBindDynamic is issued to set up the input callback.
This works, and I can have multiple rows retrieved in this fashion, EXECEPT that sometimes, Oracle does NOT call back a column, and will attempt to insert NULL for this column instead. The row/column for which this happens is apparently random, and the incidence of this is timing related (reducing the batch size also helps).
Has anyone got any idea if this is a legitimate bug in the transport interface? I have trace tables in my bindings which clearly demonstrate that a callback does NOT occur on random columns.
I've seen this problem with 8.0.5, 8.1.6, 8.1.7 on Linux (I test on 4 different machines, with various distributions), and 8.1.7 on Solaris.
I am interested in trying to keep things bound DATA_AT_EXEC to keep the code paths simplified, so I'd like to figure it out and fix it.
Similar Messages
-
How to remove the duplicate Columns in Multiple Rows?
Hi,
I want to remove the duplicate columns in a Multiple Rows.
For example:
Now i'm getting the output like this
S_NO Order_number Assy_item Assy_Desp Item_Number
1 S3123 12345 TEST *1245*
2 S3123 12345 TEST *1256*
3 S3123 12345 TEST *1289*
4 S3123 12345 TEST *1223*
5 S4123 42345 SAMPLE *4568*
6 S4123 42345 SAMPLE *5656*
7 S4123 42345 SAMPLE *4558*
the Original output should be like this
S_NO Order_number Assy_item Assy_Desp Item_Number
1 S3123 12345 TEST *1245*
2 *1256*
3 *1289*
4 *1223*
5 S4123 42345 SAMPLE *4568*
6 *5656*
7 *4558*
note: Alignment Problem all the Bold Numbers are Item Number(Last Column)*
i'm using XML and RTF template.
RTF Template is a Basic Table like Structure
i pasted the XML code below
<?xml version="1.0" encoding="UTF-8"?>
<dataTemplate name="items" version="1.0">
<parameters>
<parameter name="P_DATE" dataType="date"/>
<parameter name="P_DEPT_NO" dataType="varchar2"/>
</parameters>
<dataQuery>
<sqlStatement name="ROW1">
<![CDATA[
SELECT
SUBSTR(IMGR.ORDER_NUMBER,3,2) MACHINE_NO
,IMGR.ORDER_NUMBER
,IMGR.ASSY_ITEM_NUMBER
,IMGR.ASSEMBLY_DESCRIPTION
,IMGR.ITEM_NUMBER
,IMGR.ITEM_DESCRIPTION
,SUBSTR(IMGR.ORDER_NUMBER,1,2) DEPT_NO
,IMGR.PLAN_DESCRIPTION
FROM XXI.IGL_MRP_GROSS_REQUIREMENTS IMGR
WHERE IMGR.DEMAND_TYPE IN ('Discrete job','Non-standard job')
AND IMGR.PLAN_DESCRIPTION ='MRP-PRODUCTION'
AND IMGR.DEMAND_DATE <= :P_DATE
AND SUBSTR(IMGR.ORDER_NUMBER,1,2) IN (&P_DEPT_NO)
ORDER BY
DEPT_NO
,MACHINE_NO
,IMGR.ASSEMBLY_DESCRIPTION
,IMGR.ASSY_ITEM_NUMBER
,IMGR.ORDER_NUMBER
,IMGR.ITEM_NUMBER
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_IGLOO_QA_FPI" source="ROW1">
<element name="MACHINE_NO" value="MACHINE_NO"/>
<element name="ORDER_NUMBER" value="ORDER_NUMBER"/>
<element name="ASSY_ITEM_NUMBER" value="ASSY_ITEM_NUMBER"/>
<element name="ASSEMBLY_DESCRIPTION" value="ASSEMBLY_DESCRIPTION"/>
<element name="ITEM_NUMBER" value="ITEM_NUMBER"/>
<element name="ITEM_DESCRIPTION" value="ITEM_DESCRIPTION"/>
<element name="DEPT_NO" value="DEPT_NO"/>
<element name="PLAN_DESCRIPTION" value="PLAN_DESCRIPTION"/>
</group>
</dataStructure>
</dataTemplate>
Please Share your ideas.
Thank
Aswathhi Ananth,
i tried the logic but its also not printing the First Line.
Syntax:
<?if:ORDER_NUMBER!= ORDER_NUMBER?><?ORDER_NUMBER?><?end if?>
I think this condition works fine if it is start from second line of the row.
Output:
S_NO Order_number Assy_item Assy_Desp Item_Number
1 12345 TEST 1245
2 12345 TEST 1256
No Order_number displayed.
i hope you got my point. Please help me to get through it.
Thanks
Aswath -
2.1.0.62: Bug editing text columns in multiple rows using editor-window
Hello Forum,
I hope this is not a double post, but I did not come up with the right keywords to search for.
So here is the bug/strange annoying behavior:
When I edit multiple rows of a table using the extra edit-window, it shows the text of the previous row I edited and not the text of the actual row.
Well, sounds quit complicated so I'll give an example:
Suppose you have a table with two columns and two rows. One column is of type varchar2. Say it contains the values "one" and "two".
Now I click into the row containing "one", open the extra-edit-window and change the value to "one-1".
Then I click into the second row and also open the extra-edit-window. The window shows "one-1" instead of "two" as it should.
This is very annoying because I don't have autocommit activated and when I edit a couple of clob fields, the editor just shows the text of the previous field. I have to say commit for every row in order not to scramble the contents of multiple fields. I have to use the edit-window because the inplace editor is not very useful when editing large texts.
I observed this bug with varchar2 and clob fields but it may not be restricted to those.
I run Windows XP and conect to Oracle 10.2.0.4
Regards,
dhalekHello -K-,
setting "Post edits on row change" indeed does prevent this bug, but leads to another problem:
When I click the rollback-button, the table data is not reverted to its original state. In fact the changes are not commited, but rolling back, does not give the old data back. I can enter "rollback;" into the worksheet and then refresh the table data to show the old values but internally SQL Developer still thinks it has uncommitted changes in the table.
I, for now, uncheck "Post edits on row change" and use the inplace editor wherever possible. That has some strange cursor bugs (sometimes puts the cursor to the end making it impossible to enter text in the middle of the field) but that does not affect other rows.
Regards,
dhalek
Edited by: dhalek on 30.10.2009 15:08 -
Coinciding columns on multiple rows with GridBadLayout
I was trying to figure out why I could not initially accomplish the following with a GridBagLayout:
Row0: 0000011111
Row1: 1111122222
Row2: 2222233333 The above is supposed to be 3 JLabels on three different rows:
The 1st row has a single JLabel starting in column 0 with a width of 2, extending it to column 1.
The 2nd row has a single JLabel starting in column 1 with a width of 2, extending it to column 2.
The 3rd row has a single JLabel starting in column 2 with a width of 2, extending it to column 3.
The entire grid is 4 columns and 3 rows total.
Below I have two examples where I attempted the above. Only the 2nd example produces the desired effect. The 1st code example ends up putting both the Row 0 and Row 1 JLabel in the same column. This was surprising because I thought the GridBagLayout would give each column contained by a control enough weight to actually make those columns exist.
Here is what my first code example below produces:
Row0: 0000011111
Row1: 1111122222
Row2: 2222233333 The first two JLabels, 0000011111 and 1111122222, appear in the same column, and the 3rd JLabel appears in the seemingly 2nd column. This was confusing to me which is the point of this whole post.
In order to gain the desired effect, I had to place 4 blank dummy empty JLabel components in a non-visible Row 0 of the grid. I did this for all 4 columns of that invisible row 0. The row is non-visible because the JLabel have no text or output. After adding this non-visible Row 0, all of the original mentioned Rows 0 through 2 become Rows 1 through 2 respectively.
For example:
Row0: iiiiiIIIIIiiiiiIIIII
Row1: 0000011111
Row2: 1111122222
Row3: 2222233333 The above shows an inserted Row 0 with invisible labels that are not seen, but they seem to give weight to each column, allowing each to exist. Without doing this, as mentioned, the first code example (shown below) fails. The second example (also below) works, so it appears that putting the invisible controls into the first row, one in each column, somehow gives enough weight to each column to "establish" the column more so than otherwise.
The big question I have is why didn't the first example work?
I mean, in that example, I'm giving each JLabel equal weight, and each one takes up a width of 2 columns, so why doesn't the JLabel in the second row end up in column 1? Instead, both the original row 0 and row 1 JLabels appear in what looks like column 0, the same column. Does anyone know why this happened?
The invisible control solution is fine but I'm just curious why it wasn't as intuitive as it should have been. The only thing I can come up with is that the weight of the 1st and 2nd JLabel (row 0 and 1) got combined in some fashion which combined them into column 1 which end up looking like column 0 since 0 somehow looses all weight. (???)
****************** THE FOLLOWING DOES NOT PRODUCE THE RIGHT EFFECTS ******************
public class TestCoincidingColumns1 extends javax.swing.JFrame {
/** Creates new form TestCoincidingColumns1 */
public TestCoincidingColumns1() {
initComponents();
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new java.awt.GridBagLayout());
jLabel1.setText("LabelRow0Col0Wid2");
jLabel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 255, 255)));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
getContentPane().add(jLabel1, gridBagConstraints);
jLabel2.setText("LabelRow1Col1Wid2");
jLabel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
getContentPane().add(jLabel2, gridBagConstraints);
jLabel3.setText("LabelRow2Col2Wid2");
jLabel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 255, 0)));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 2;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
getContentPane().add(jLabel3, gridBagConstraints);
pack();
}// </editor-fold>
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new TestCoincidingColumns1().setVisible(true);
// Variables declaration - do not modify
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
// End of variables declaration
****************** THE FOLLOWING WORKS ******************
public class TestCoincidingColumns1WithFix extends javax.swing.JFrame {
/** Creates new form TestCoincidingColumns1WithFix */
public TestCoincidingColumns1WithFix() {
initComponents();
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
DummyRow0Col0 = new javax.swing.JLabel();
DummyRow0Col1 = new javax.swing.JLabel();
DummyRow0Col2 = new javax.swing.JLabel();
DummyRow0Col3 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new java.awt.GridBagLayout());
jLabel1.setText("LabelRow0Col0Wid2");
jLabel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 255, 255)));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
getContentPane().add(jLabel1, gridBagConstraints);
jLabel2.setText("LabelRow1Col1Wid2");
jLabel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
getContentPane().add(jLabel2, gridBagConstraints);
jLabel3.setText("LabelRow2Col2Wid2");
jLabel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 255, 0)));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 3;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
getContentPane().add(jLabel3, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.weightx = 1.0;
getContentPane().add(DummyRow0Col0, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.weightx = 1.0;
getContentPane().add(DummyRow0Col1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
gridBagConstraints.weightx = 1.0;
getContentPane().add(DummyRow0Col2, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 0;
gridBagConstraints.weightx = 1.0;
getContentPane().add(DummyRow0Col3, gridBagConstraints);
pack();
}// </editor-fold>
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new TestCoincidingColumns1WithFix().setVisible(true);
// Variables declaration - do not modify
private javax.swing.JLabel DummyRow0Col0;
private javax.swing.JLabel DummyRow0Col1;
private javax.swing.JLabel DummyRow0Col2;
private javax.swing.JLabel DummyRow0Col3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
// End of variables declaration
}gridwidth=1 will produce something like the following:
Row0: 00000
Row1: 11111
Row2: 22222where each component has its own column which is not the effect I was looking for. The effect is where a component appears halfway, or partway into the middle of the prior row's component's column. See original post for example.
See URL in my prior post for a different thread with a post containing details as to why it's not possible to do what I want to do with GridBagLayout unless I use hidden columns to define each column that I want. When I do that, I can place a component midway into what appears to be the column for the prior row's component.
Thanks for trying though. -
Select single column but multiple rows in JTable
Hi
I have a jTable and want to be able to select multiple rows but only in a single column.
I've set these properties which makes selection almost the way I would like it.
table1.setCellSelectionEnabled(true);
table1.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);the only problem now is that the user can select multiple columns.
Is there a simple way to restrict selection to single column?
regards
abqtable.setCellSelectionEnabled(true);
table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
DefaultListSelectionModel model =
(DefaultListSelectionModel)table.getColumnModel().getSelectionModel();
model.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); -
Need query to convert Single Row Multiple Columns To Multiple rows
Hi,
I have a table with single row like below
Column0 | Column1 | Column2 | Column3 | Column4|
Value0 | Value1 | Value2 | Value3 | Value4 |
Am looking for a query to convert above table data to multiple rows having column name and its value in each row as shown below
Column0 | Value0
Column1 | Value1
Column2 | Value2
Column3 | Value3
Column4 | Value4
Thanks in advance.
MohanHi ykMohan,
Dynamic UNPIVOT can be applied in this case as well.
CREATE TABLE dbo.T(ID INT,Column0 VARCHAR(99),Column1 VARCHAR(99),Column2 VARCHAR(99),Column3 VARCHAR(99),Column4 VARCHAR(99))
INSERT INTO T VALUES
(1,'Value0','Value1','Value2','Value3','Value4'),
(2,'Value0','Value1','Value2','Value3','Value4');
DECLARE @columns VARCHAR(MAX)
SELECT @columns=
STUFF(
SELECT ','+ COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME ='T' AND TABLE_SCHEMA='dbo' AND Column_name NOT IN('ID') FOR XML PATH('')
),1,1,'')
DECLARE @Sql NVARCHAR(MAX)
SET @Sql =
'SELECT ID, UPT.col,UPT.val FROM T
UNPIVOT
(val FOR col IN('+@columns+')) AS UPT'
EXEC sp_executeSQL @Sql
DROP TABLE T
If you have any feedback on our support, you can click
here.
Eric Zhang
TechNet Community Support -
How to create a view with columns from multiple rows
I have posted this in SQL/PSL forum, but I hope database experts in this group can give me ideas too, also the need is from BI reports.
I have a table, say, project_milestones, which has these columns in concern:
proj_id, milestone_name, actual_end_date
with data:
proj_id, milestone_name, actual_end_date
===== ================ ==============
1001, Key Element Approve, 2009-10-02
1001, Final Synopsis, 2009-10-07
1001, Final Protocol Approved, 2009-10-15
1001, FPFV, 2010-01-10
1001, LPFV, 2010-03-12
1002, Key Element Approve, 2008-12-02
1002, Final Synopsis, 2009-01-07
1002, Final Protocol Approved, 2009-01-12
1002, FPFV, 2009-03-30
1002, LPFV, 2009-10-04
There are about 10 milestones in each project.
I have to create a view to flat these data at project level, looks like this:
proj_id, key_element_date, final_synopsis_date, final_protocol_approved_date, FPFV_date, LPFV_date, key_element_to_final_synopsis_days, final_synopsis_final_protocol_days, ....
How can I do this?
Thanks,user9175541 wrote:
I have posted this in SQL/PSL forum, but I hope database experts in this group can give me ideas too, also the need is from BI reports.
I have a table, say, project_milestones, which has these columns in concern:
proj_id, milestone_name, actual_end_date
with data:
proj_id, milestone_name, actual_end_date
===== ================ ==============
1001, Key Element Approve, 2009-10-02
1001, Final Synopsis, 2009-10-07
1001, Final Protocol Approved, 2009-10-15
1001, FPFV, 2010-01-10
1001, LPFV, 2010-03-12
1002, Key Element Approve, 2008-12-02
1002, Final Synopsis, 2009-01-07
1002, Final Protocol Approved, 2009-01-12
1002, FPFV, 2009-03-30
1002, LPFV, 2009-10-04
There are about 10 milestones in each project.
I have to create a view to flat these data at project level, looks like this:
proj_id, key_element_date, final_synopsis_date, final_protocol_approved_date, FPFV_date, LPFV_date, key_element_to_final_synopsis_days, final_synopsis_final_protocol_days, ....
How can I do this?
Thanks,Create a pivot table and put "milestone_name" in the Columns section under the Labels.
Put "actual_end_date" in the Measures section and change the Aggregation Rule to "Max."
The rest of the attributes keep in Rows section. -
Date & time difference in a single column but multiple rows in a table
hi folks,
am using Oracle db 10g by chance is there any other way to do my requirement.
as I stated in my subject.You probably need LAG:
SQL> -- generating sample data (how hard can it be...)
SQL> with testdata as (
2 select 200 bno, 32 temperature, to_date('28.05.2012 09:00:00', 'dd.mm.yyyy hh24:mi:ss') dt from
dual union
3 select 200, 36,to_date('28.05.2012 15:00:00', 'dd.mm.yyyy hh24:mi:ss') from dual
4 )
5 --
6 -- actual query:
7 --
8 select bno
9 , temperature
10 , dt
11 , numtodsinterval(dt-lag(dt) over (partition by bno order by dt), 'day') difference_int
12 , substr((numtodsinterval(dt-lag(dt) over (partition by bno order by dt), 'day')), 12, 8)
difference_dt
13 from testdata;
BNO TEMPERATURE DT DIFFERENCE_INT DIFFEREN
200 32 28-05-2012 09:00:00
200 36 28-05-2012 15:00:00 +000000000 06:00:00.000000000 06:00:00
2 rows selected.But, as Paulie already said: still insufficient input. We know nothing about your datatypes. I assumed you're using a DATE. -
How to Make FUNCTION to return multiple column and multiple row output
Hi All,
Kindly Share ur Idea;Thanks in Advance;
i Have Table Demo.
table DEMO:
id name
1 a10
1 a11
1 a12
2 b10
2 b11
3 ccc
and the function is like:
create or replace function (p1 number) return varchar2 as
vid number;
vname varchar2(20);
begin
select id,name into vid,vname from demo where id=p1;
return v1;
end;
this function returns output for id=3;
BUT,
i need output as (for input as 1)
vid vname
1 a10
1 a11
1 a12A function returns a single datatype.
That datatype may be an atomic datatype (varchar2, number etc.) or it may be an object/record datatype, or even a collection datatype.
Where are you going to use this function? In PL/SQL or SQL?
If you are wanting to use it in SQL, then you would need a pipelined function e.g.
SQL> CREATE OR REPLACE TYPE myemp AS OBJECT
2 ( empno number,
3 ename varchar2(10),
4 job varchar2(10),
5 mgr number,
6 hiredate date,
7 sal number,
8 comm number,
9 deptno number
10 )
11 /
Type created.
SQL> CREATE OR REPLACE TYPE myrectable AS TABLE OF myemp
2 /
Type created.
SQL> CREATE OR REPLACE FUNCTION pipedata(p_min_row number, p_max_row number) RETURN myrectable PIPELINED IS
2 v_obj myemp := myemp(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
3 BEGIN
4 FOR e IN (select *
5 from (
6 select e.*
7 ,rownum rn
8 from (select * from emp order by empno) e
9 )
10 where rn between p_min_row and p_max_row)
11 LOOP
12 v_obj.empno := e.empno;
13 v_obj.ename := e.ename;
14 v_obj.job := e.job;
15 v_obj.mgr := e.mgr;
16 v_obj.hiredate := e.hiredate;
17 v_obj.sal := e.sal;
18 v_obj.comm := e.comm;
19 v_obj.deptno := e.deptno;
20 PIPE ROW (v_obj);
21 END LOOP;
22 RETURN;
23 END;
24 /
Function created.
SQL> select * from table(pipedata(1,5));
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-1980 00:00:00 800 20
7499 ALLEN SALESMAN 7698 20-FEB-1981 00:00:00 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-1981 00:00:00 1250 500 30
7566 JONES MANAGER 7839 02-APR-1981 00:00:00 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-1981 00:00:00 1250 1400 30
SQL> select * from table(pipedata(6,10));
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7698 BLAKE MANAGER 7839 01-MAY-1981 00:00:00 2850 30
7782 CLARK MANAGER 7839 09-JUN-1981 00:00:00 2450 10
7788 SCOTT ANALYST 7566 19-APR-1987 00:00:00 3000 20
7839 KING PRESIDENT 17-NOV-1981 00:00:00 5000 10
7844 TURNER SALESMAN 7698 08-SEP-1981 00:00:00 1500 0 30
SQL> select * from table(pipedata(11,15));
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7876 ADAMS CLERK 7788 23-MAY-1987 00:00:00 1100 20
7900 JAMES CLERK 7698 03-DEC-1981 00:00:00 950 30
7902 FORD ANALYST 7566 03-DEC-1981 00:00:00 3000 20
7934 MILLER CLERK 7782 23-JAN-1982 00:00:00 1300 10
SQL>If you are using it in PL/SQL then just populating a collection datatype and returning that will do. Though you should question why you want to pass large amounts of data around like that first.
Explain your purpose and what you are intending to do and we can recommend the best way.
{message:id=9360002} -
Splitting comma seperated column data into multiple rows
Hi Gurus,
Please help me for solving below scenario. I have multiple value in single column with comma seperated values and my requirement is load that data into multiple rows.
Below is the example:
Source Data:
Product Size Stock
ABC X,XL,XXL,M,L,S 1,2,3,4,5,6
Target Data:
Product Size Stock
ABC X 1
ABC XL 2
ABC XXL 3
ABC M 4
ABC L 5
ABC S 6
Which transformation we need to use for getting this output?
Thanks in advance !Hello,
Do you need to do this tranformation through OWB mapping only? And can you please tell what type of source you are using? Is it a flat file or a table?
Thanks -
Drill Down between 2 stacked column chart with multiple rows.
Hi,
Can anyone please help me.
1) i have to create stacked column chart with Region and cout of calls for previous 3 quarters.
2) the 2nd stacked column should display the priority with the count of calls for the respective selection of region on the 1st chart..
to achieve this,
i'm using 2 stacked column charts and 1 lebel baseb menu.
from this i can able to get the drill down from label based menu to 2nd stacked column chart but i couldn't able to done the same from 1st stacked coumn chart.
Becoz my data is multiple row for each quarter.
please suggest me to achieve the drill down between 2 stacked column charts.
assume that my data like below.:
coulmns for 1st stacked column chart : Region, Q2,Q3 &Q4
Region Q2 Q3 Q4
Other 3658 3497 497
NA - North
America 3 3 1101
APJK 1 4 597
UK 324
EMEA North 1 1 288
CORPORATE 1 5 215
LA -
Latin America1 2 208
EMEA 1 199
EMEA South 1 1 169
Coulmns for 2nd coumn chart: Region, Priority, Q2,Q3,Q4 ()which is derived from 1st table.
Region Priority Q2 Q3 Q4
Other D: End of Next Day 1568 1613 239
Other C: End of Day 983 893 119
Other A: 2 Hour 631 610 70
Other B: 4 Hour 396 318 56
NA -
North AmericaD: End of Next Day 2 2 514
APJK D: End of Next Day 3 297
NA -
North AmericaC: End of Day 284
NA -
North AmericaA: 2 Hour 1 170
UK D: End of Next Day 157
APJK C: End of Day 1 1 152
Other E: 3 - 5 Business Days 68 58 13
EMEA North D: End of Next Day 1 136
CORPORATE D: End of Next Day 4 107
NA - North America B: 4 Hour 1 104
LA - Latin America D: End of Next Day 1 1 86
EMEA D: End of Next Day 86
UK C: End of Day 85
APJK A: 2 Hour 79
EMEA South D: End of Next Day 72
EMEA North A: 2 Hour 69
EMEA North C: End of Day 56
APJK B: 4 Hour 55
EMEA C: End of Day 1 53
LA - Latin America C: End of Day 54
UK A: 2 Hour 49
EMEA South C: End of Day 1 44
CORPORATE A: 2 Hour 1 43
CORPORATE C: End of Day 44
LA - Latin America A: 2 Hour 1 42
EMEA South A: 2 Hour 1 32
EMEA B: 4 Hour 30
UK B: 4 Hour 30
EMEA A: 2 Hour 27
EMEA North B: 4 Hour 1 26
NA -
North AmericaE: 3 - 5 Business Days 25
LA - Latin America B: 4 Hour 23
EMEA South B: 4 Hour 20
CORPORATE B: 4 Hour 17
APJK E: 3 - 5 Business Days 13
Other F: 6 - 10 Business Days 6 4
Other G: 11 - 20 Business Days 6 1Hi Srinivas,
I'm using label based menu "filterd rows" only but i couldn't bind the drill down with the 1st stacked column chart.
for mor details:
1) i'm having 2 stacked coumn charts & 1 lebel based menu but eventhough i couldn't able to achieve.
if i select the lebel based values then the 2nd stacked column charts is giving detailed valus but if i keep my mouse on the 1st stacked column chart the there is no changes on the 2nd chart..
somewhere i'm mising the binding data between 1st stacked coumn chart & lebel based menu on drill down part.
Becoz i'm having multiple rows. so can you please try your and send me the xlf file using your concept. -
How To Concatenate Column Values from Multiple Rows into a Single Column?
How do I create a SQL query that will concatenate column values from multiple rows into a single column?
Last First Code
Lesand Danny 1
Lesand Danny 2
Lesand Danny 3
Benedi Eric 7
Benedi Eric 14
Result should look like:
Last First Codes
Lesand Danny 1,2,3
Benedi Eric 7,14
Thanks,
David JohnsonStarting with Oracle 9i
select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
from
(select last, first, code, row_number() over(partition by last, first order by code) rn
from a)
connect by last = prior last and first = prior first and prior rn = rn -1
start with rn = 1
group by last, first
LAST FIRST CODES
Lesand Danny 1,2,3
Benedi Eric 7,14Regards
Dmytro -
SQL Loader Inserts chr(13) and chr(10) in the first column of every row.
Hi,
I have exported a data in a pipe delimited file using TOAD in one database. Now I want to load the data in my local database using SQL Loader. However every time I try to load the data a double quote followed by a new line is entered for the first column of each row. Unfortunately the delimited file is very big and hence can't be posted here. However I tried the same with a customized table and its data and found the same problem. Below are the table structures and control file that I used.
create table test_sql
a varchar2(30),
b date
insert into test_sql values('51146263',sysdate-3);
insert into test_sql values('51146261,sysdate-1);
EXPORTED PIPE DELIMITED FILE_
A|B|!##!
51146261|04/14/13 4:55:18 PM|!##!
51146263|04/12/13 4:55:32 PM|!##!
create table test_sql1 as select * from test_sql where 1=2;
CONTROL FILE_
OPTIONS(SKIP=1)
LOAD DATA
INFILE 'C:\Users\Prithwish\Desktop\Test.txt' "str '!##!'"
PRESERVE BLANKS
INTO TABLE TEST_SQL1
FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
A CHAR(2000),
B DATE "MM/DD/YYYY HH12:MI:SS AM"
select * from TEST_SQL1;
After this when I paste it in notepad I get the following result
A B
51146261" 14-APR-0013 16:55:18
51146263" 12-APR-0013 16:55:32.
I have no idea how the quotes or the newline appear. Is this a Toad bug? Any help would be greatly appreciated. Really urgent.
Thanks in advance
RegardsHi Harry,
I actually thought that the str !##! was causing the problem. Actually my original export has some new lines in some specific columns so I can't keep the new line as my line terminator and hence I kept the !##! as my terminator.
When I put the same data in a notepad and load it there is no problem at all. For e.g I just typed the following in a notepad and the data loaded just fine.
A|B|!##!
51146261|01-01-01 10:10:10 AM|!##!
51146263|01-01-01 11:11:11 AM|!##!
Its just when I load the exported file there the problem arises though I have verified the file using UNIX as well using octal dump and found no hidden characters.
Regards,
Prithwish -
Need to Convert Comma separated data in a column into individual rows from
Hi,
I need to Convert Comma separated data in a column into individual rows from a table.
Eg: JOB1 SMITH,ALLEN,WARD,JONES
OUTPUT required ;-
JOB1 SMITH
JOB1 ALLEN
JOB1 WARD
JOB1 JONES
Got a solution using Oracle provided regexp_substr function, which comes handy for this scenario.
But I need to use a database independent solution
Thanks in advance for your valuable inputs.
GeorgeGo for ETL solution. There are couple of ways to implement.
If helps mark -
Multiple values from same column in diffetent columns in same row??
Hi all,
I am wondering how you can display different values from the same column into different columns on same row. For example using a CASE statement I can:
CASE WHEN CODE IN ('1', '3') THEN COUNT( ID) END as "Y"
CASE WHEN CODE NOT IN ('1', 'M') THEN COUNT( ID) END as "N"
Yes this will produce two columns needed but will also produce two separate records and null values for the empty's.
Any ideas?
ThanksIt's not clear what you want.
Can you post some examples as described in the FAQ: {message:id=9360002}
As my first guess, I would think you're looking for something like...
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-1980 00:00:00 800 20
7499 ALLEN SALESMAN 7698 20-FEB-1981 00:00:00 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-1981 00:00:00 1250 500 30
7566 JONES MANAGER 7839 02-APR-1981 00:00:00 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-1981 00:00:00 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-1981 00:00:00 2850 30
7782 CLARK MANAGER 7839 09-JUN-1981 00:00:00 2450 10
7788 SCOTT ANALYST 7566 19-APR-1987 00:00:00 3000 20
7839 KING PRESIDENT 17-NOV-1981 00:00:00 5000 10
7844 TURNER SALESMAN 7698 08-SEP-1981 00:00:00 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-1987 00:00:00 1100 20
7900 JAMES CLERK 7698 03-DEC-1981 00:00:00 950 30
7902 FORD ANALYST 7566 03-DEC-1981 00:00:00 3000 20
7934 MILLER CLERK 7782 23-JAN-1982 00:00:00 1300 10
14 rows selected.
SQL> select count(case when deptno in (10,20) then deptno end) as deptno_10_20
2 ,count(case when deptno > 20 then deptno end) as deptno_30plus
3 from emp;
DEPTNO_10_20 DEPTNO_30PLUS
8 6
Maybe you are looking for
-
Hello friends, I am created a drop shipment order with all the setups done . now i have booked the sale order as source type external. but when i run the workflow background process , after completing the report when i check the sale order line statu
-
Populate two additional select boxes from main box...
hey all - i am new at most of this, so please bare with me. I am trying to go from one box to the next (twice over), and am having difficulty getting to the third box. I have the original box "select1" and it populates "select two" just fine, but i d
-
Item-level Permissions availabe in list advance setting not working.
Hi, Recently i had an requirement of maintaining item level permission. My requirement was that whenever an item is created in list, it should be created with uniqure permission. I know how to do it by writing custom code, but i don't want to do
-
Fi consultant role in Fi-MM integration
hi sap gurus, can anybody help me '<b>what is the role of a Fi Consultant in the fi - mm integration</b>' phase. points will be awarded. regards, vicky.
-
Can Premiere Pro resume when computer sleeps in middle of rendering?
My computer core i7 64 bit 1.6 CPU (boosts up to 2.5) 6 gigs ram My footage source: 1920x1080 Output: 720x480 Time of footage 54 min File Size 2.5 gigs Render time When I had it set to Qualtiy 5.0, Bitrate 5 -7, VBR 2 pass, and checked Max. Render qu