Need help on derivation of complex column
Hi,
I have a requirement to derive a column in my report which has slightly complex logic and hence need your help.
I have oracle 10g database.
Background: The data is stored in a quiet complex way in table hence trying to let you understand in words. I have incidences stored in my table. These incidences can be completed by certain numbers of plans and further a single plan can be completed by certain numbers of activities. Structure is like below.
Table 1
*Incidences* *Incidence_id*
Incidence_1 1
Incidence_2 2
Incidence_3 3
Table 2
*Plan_name* *Plan_id* *incidence_id*
Plan_1 1 1
Plan_2 2 1
Plan_3 3 1
Plan_1 1 2
Plan_2 2 2
Plan_3 3 2
Plan_1 1 3
Plan_2 2 3
Plan_3 3 3
I have Activity 1, Activity 2, Activity 3, Activity 4 are predefined activities which can be repeated in a plan like shown in below table.
Table 3
*Activity _name* *Activity_id* *Plan_id* *incidence_id*
Activity_1 1 1 1
Activity_2 2 1 1
Activity_3 3 1 1
Activity_4 4 1 1
Activity_1 5 1 1
Activity_1 6 2 1
Activity_2 7 2 1
Activity_3 8 3 1
Activity_2 9 3 1
Activity_1 10 3 1Now in table 3 for plan_id 1 I have two Activity 1 and one Activity 3. from my functional knowledge I know that first Activity 1 is the parent activity of Activity 3, but there is no any way in a table to identify that logically. Can you please tell me any way so that I can have first Activity 1 as my output if I want parent activity of Activity 3?
Let me know if you have any questions to understand my requirement.
Edited by: 968625 on Jan 14, 2013 7:08 AM
Edited by: 968625 on Jan 14, 2013 7:37 AM
Hi,
968625 wrote:
Hi,
I have a requirement to derive a column in my report which has slightly complex logic and hence need your help.
I have oracle 10g database.
Background: The data is stored in a quiet complex way in table hence trying to let you understand in words. I have incidences stored in my table. These incidences can be completed by certain numbers of plans and further a single plan can be completed by certain numbers of activities. Structure is like below.
Table 1
*Incidences* *Incidence_id*
Incidence_1 1 ...
Whenever you have a question, please post CREATE TABLE and INSERT statements for your sample data, so the poeple who want to help you can re-create the problem and test their ideas. Also post the results you want from that data.
See the forum FAQ {message:id=9360002}
Now in table 3 for plan_id 1 I have two Activity 1 and one Activity 3. from my functional knowledge I know that first Activity 1 is the parent activity of Activity 3, but there is no any way in a table to identify that logically. Can you please tell me any way so that I can have first Activity 1 as my output if I want parent activity of Activity 3?If you want a query to know (or deduce) that Activity 1 is the parent of Activity 3, then that information has to be stored someplace where the query can see it.
If each activity can have (at most) 1 parent, then it seems like the most logical place is the table3: add another column to the table, and keep the parent activity there.
If a single parent can have multiple children, and, at the same time, a single child can have multiple parents, then you probably need a separate table for the parent-child relationships.
You could hard-code information about the parent-child relationships in the query itself, but I doubt that's the best way to solve this problem.
Let me know if you have any questions to understand my requirement.I don't understand what results you want from the given data. Once again, please post CREATE TABLE and INSERT statements for the sample data, and the exact results you want. Use specific examples from that output to explain how you get the right results from the given data.
Similar Messages
-
Need help with Pivoting rows to columns
Hi,
I need help with pivoting rows to columns. I know there are other posts regarding this, but my requirement is more complex and harder. So, please give me a solution for this.
There are two tables say Table 1 and Table 2.
Table1
name address email identifier
x e g 1
f s d 2
h e n 3
k l b 4
Table2
identifier TRno zno bzid
1 T11 z11 b11
1 T12 z12 b12
1 T13 z13 b13
2 T21 z21 b21
2 T22 z22 b22
As you can see the identifier is the column that we use to map the two tables. The output should be like below
output
name address email identifier TRno1 zno1 bzid1 TRno2 zno2 bzid2 TRno3 zno3 bzid3
x e g 1 T11 z11 b11 T12 z12 b12 T13 z13 b13
f s d 2 T21 z21 b21 t22 z22 b22
Also we do not know exactly how many TRno's, zno's, etc each value in the identifier will have. There may be only 1 TRNO, zno and bzid, or there may be four.
All the values must be in separate columns, and not be just comma delimitted. There are also other conditions that i have to add to restrict the data.
So, can you please tell me what is should use to get the data in the required format? We are using Oracle 10g. Please let me know if u need any more informationSomething like this ?
SCOTT@orcl> ed
Wrote file afiedt.buf
1 select a.name,
2 a.address,
3 a.email,
4 b.* from (
5 select distinct identifier
6 ,max(trno1) trno1
7 ,max(zno1) zno1
8 ,max(bzid1) bzid1
9 ,max(trno2) trno2
10 ,max(zno2) zno2
11 ,max(bzid2) bzid2
12 ,max(trno3) trno3
13 ,max(zno3) zno3
14 ,max(bzid3) bzid3
15 ,max(trno4) trno4
16 ,max(zno4) zno4
17 ,max(bzid4) bzid4
18 from (select identifier
19 ,decode(rn,1,trno,null) trno1
20 ,decode(rn,1,zno,null) zno1
21 ,decode(rn,1,bzid,null) bzid1
22 ,decode(rn,2,trno,null) trno2
23 ,decode(rn,2,zno,null) zno2
24 ,decode(rn,2,bzid,null) bzid2
25 ,decode(rn,3,trno,null) trno3
26 ,decode(rn,3,zno,null) zno3
27 ,decode(rn,3,bzid,null) bzid3
28 ,decode(rn,4,trno,null) trno4
29 ,decode(rn,4,zno,null) zno4
30 ,decode(rn,4,bzid,null) bzid4
31 from (select identifier,
32 trno,bzid,zno,
33 dense_rank() over(partition by identifier order by trno,rownum) rn
34 from table2)
35 order by identifier)
36 group by identifier) b,table1 a
37* where a.identifier=b.identifier
SCOTT@orcl> /
NAME ADDRESS EMAIL IDENTIFIER TRNO1 ZNO1 BZID1 TRNO2 ZNO2 BZID2 TRNO3 ZNO3 BZID3 TRNO4 ZNO4 BZID4
x e g 1 T11 z11 b11 T12 z12 b12 T13 z13 b13
f s d 2 T21 z21 b21 T22 z22 b22
SCOTT@orcl> select * from table1;
NAME ADDRESS EMAIL IDENTIFIER
x e g 1
f s d 2
h e n 3
k l b 4
SCOTT@orcl> select * from table2;
IDENTIFIER TRNO ZNO BZID
1 T11 z11 b11
1 T12 z12 b12
1 T13 z13 b13
2 T21 z21 b21
2 T22 z22 b22
SCOTT@orcl>Regards
Girish Sharma -
Need help to develop report with column chart
Hi
I am new to SAP BO world.Could anyone please help me to design report with column chart.Please guide me how to develop report for the following requirement.I am not aware of variance columns and variance labels.Please provide some guidance or some tutorials(for column Chart) so that I can complete the task. Please reply me as soon as possible.Waiting for reply.Thanks in advance.
Type: Column Chart
u2022 Rows: Banking Asset Margin (%)
u2022 Start / End Columns: PY YTD Act(Prior year year to date); CY YTD Act(Current year Year to date)
u2022 Variance Columns: # Var (CY-PY Act) for GOLM; Volume; Rate; Non Banking NII; Banking Volatility in NII; Banking Volatility in OOI; Fees/One Offs/Other; Volatile Items; Sophie
u2022 Sub-total columns: PY YTD Underlying; CY YTD Underlying.
u2022 Variance Labels: % Var (CY-PY Act) for Total Income and Underlying Income
u2022 Sub-Total Labels: # Var (CY-PY Act) for Net Insurance Income; Banking Volatility; Other Operating Income
Additional information
u2022 Variance columns (bar) colours: Red = Adverse to Prior Year; Green = Favourable to Prior Year
u2022 Columns to show values. Adverse values to be shown in red text in brackets. Favourable results in black text.
u2022 All values in Black, but adverse to be shown below the bar.Hi,
This type of question is almost impossible to answer over a forum .
You need to work with your business to understand what these requirements mean in terms of data modelling and relationships between object entities.
- Some of these metrics should be delegated to source, and calculated in the update routines to your datatargets (aka Cubes/Tables)
- Others could be resolved in the semantic layer (Universe)
- Other will be calculated in the presentation layer as local formulae or variables.
whilst BusinessObjects is a fairly intuitive tool, it may be unreasonble to expect a new learner to deliver an advanced report with conditional formatting.
Regards,
H -
Need help in double click the column in ALV
hello all ,
I am new to Abap coding . I have got the following requirement .
there are 2 columns in my alv grid output list . First column shows both the sales orders and Quotation .
2nd column shows the document type ..If the document type is ZQT then that is recognised as Quotation . For the remaining documnets types all are sales orders. Please see sample list ..
Salesorder/quotation | Document type
| -
| -
| ZQT
| -
| -
So if the users double clicks on Sales order it has to go to VA02 transaction .
If the user double clicks on quotationin that same column it has to go to VA22 transaction .
Please tell me how to achieve thisfunctionality in the same column .
ThanksAs per your requirement i put one example so it will help to solve your issue
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
ls_fieldcat-cfieldname = &3.
ls_fieldcat-qfieldname = &4.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
TYPE-POOLS: slis. " ALV Global types
TYPES:
BEGIN OF ty_vbak,
vkorg TYPE vbak-vkorg, " Sales organization
kunnr TYPE vbak-kunnr, " Sold-to party
vbeln TYPE vbak-vbeln, " Sales document
netwr TYPE vbak-netwr, " Net Value of the Sales Order
waerk TYPE vbak-waerk, " Currency
END OF ty_vbak,
BEGIN OF ty_vbap,
vbeln TYPE vbap-vbeln, " Sales document
posnr TYPE vbap-posnr, " Sales document item
matnr TYPE vbap-matnr, " Material number
arktx TYPE vbap-arktx, " Short text for sales order item
kwmeng TYPE vbap-kwmeng, " Order quantity
vrkme TYPE vbap-vrkme, " Quantity Unit
netwr TYPE vbap-netwr, " Net value of the order item
waerk TYPE vbap-waerk, " Currency
END OF ty_vbap.
DATA :
gs_vbak TYPE ty_vbak,
* Data displayed in the first list
gt_vbak TYPE TABLE OF ty_vbak,
* Data displayed in the second list
gt_vbap TYPE TABLE OF ty_vbap.
SELECT-OPTIONS :
s_vkorg FOR gs_vbak-vkorg, " Sales organization
s_kunnr FOR gs_vbak-kunnr, " Sold-to party
s_vbeln FOR gs_vbak-vbeln. " Sales document
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
PERFORM f_read_data_vbak.
PERFORM f_display_data_vbak. -
Need help in displaying Rows to Columns
Hi,
I am facing problem in displaying Rows to Columns
I am using pivot function:
select *
from
(select vendor_name
from tablea)
pivot
(count(vendor_name)
for vendor_name in ('a,b,'c'));
its working fine showing vendor_name and count
but when i want to display the output as:(How to include the Salalry column in the query?)
Name:{a b c}
Sal Total:(400,600,800}
Any help will be needful for meNot sure what you mean:
select *
from (select deptno,sal from emp)
pivot(sum(sal) for deptno in (10,20,30))
10 20 30
8750 10875 9400
SQL> SY. -
Need help in some what complex transpose of data...
Dear Team,
I need a small help, to transpose the data...
The Input data is shown below...
Product
Level
Position
Route
1st_Prod_id
Request_Flag
Qty
99904228
LEVEL_1
1
1
828452
Y
0
96500436
LEVEL_2
2
1
828452
N
1
96500437
LEVEL_2
3
1
828452
N
1
96500437
LEVEL_3
4
1
828452
N
2
66500084
LEVEL_3
5
1
828452
Y
0
67653972
LEVEL_3
6
1
828452
N
2
47418545
LEVEL_4
7
1
828452
Y
0
47418545
LEVEL_5
8
1
828452
N
0
35264043
LEVEL_5
9
1
828452
N
2
37411616
LEVEL_5
10
1
828452
N
0
35264044
LEVEL_6
11
1
828452
Y
2
The output format is shown below along with transpose logic...
Dmd_Product
From_Prod
From_Level
To_Prod
To_Level
Total_QtY
99904228
99904228
LEVEL_1
66500084
LEVEL_3
4
99904228
66500084
LEVEL_3
47418545
LEVEL_4
2
99904228
47418545
LEVEL_4
35264044
LEVEL_6
4
1. Depending upon the Req_Flag = 'Y', we have to identify our from_product - to_product, & from_level - to_level...
2. Between from_product - to_product we have to sum up the quantity (QTY)
3. The position 1 product should remain as it throught out the transformation and shown under new column Dmd_Prod
4. Between Position 1 and Position 5 we have 2 Req_Flag --> One req_flag = 'Y' at pos = 1 and another req_flag = 'Y' at pos = 5
So my From_Product will be product as pos = 1 and to_product will be product at pos = 5...
5. The same iteration goes on and my product at pos = 5 becomes my from_product and another item at pos = 7 becomes to_product... and so on...
I hope i am clear in my explanation...
please give me some hints or tips how to solve it...
Attached is the create table statement for sample data...
Create Table test As
(Select 99904228 prod, 'LEVEL_1' l_level, 828452 first_prod_id, 1 position, 1 route, 'Y' req_flag, 0 qty From dual Union All
Select 96500436 prod, 'LEVEL_2' l_level, 828452 first_prod_id, 2 position, 1 route, 'N' req_flag, 1 qty From dual Union All
Select 96500437 prod, 'LEVEL_2' l_level, 828452 first_prod_id, 3 position, 1 route, 'N' req_flag, 1 qty From dual Union All
Select 96500437 prod, 'LEVEL_3' l_level, 828452 first_prod_id, 4 position, 1 route, 'N' req_flag, 2 qty From dual Union All
Select 66500084 prod, 'LEVEL_3' l_level, 828452 first_prod_id, 5 position, 1 route, 'Y' req_flag, 0 qty From dual Union All
Select 67653972 prod, 'LEVEL_3' l_level, 828452 first_prod_id, 6 position, 1 route, 'N' req_flag, 2 qty From dual Union All
Select 47418545 prod, 'LEVEL_4' l_level, 828452 first_prod_id, 7 position, 1 route, 'Y' req_flag, 0 qty From dual Union All
Select 47418545 prod, 'LEVEL_5' l_level, 828452 first_prod_id, 8 position, 1 route, 'N' req_flag, 0 qty From dual Union All
Select 35264043 prod, 'LEVEL_5' l_level, 828452 first_prod_id, 9 position, 1 route, 'N' req_flag, 2 qty From dual Union All
Select 37411616 prod, 'LEVEL_5' l_level, 828452 first_prod_id, 10 position, 1 route, 'N' req_flag, 0 qty From dual Union All
Select 35264044 prod, 'LEVEL_6' l_level, 828452 first_prod_id, 11 position, 1 route, 'Y' req_flag, 2 qty From dual
Regards
nic..Maybe
select dmd_product,
from_product,
from_level,
to_product,
to_level,
total_qty,
agg_yield
from (select position,
dmd_product,
case when to_flag = 'Y' and lag(from_flag,1) over (order by position) = 'Y'
then lag(from_product,1) over (order by position)
end from_product,
case when to_flag = 'Y' and lag(from_flag,1) over (order by position) = 'Y'
then lag(from_level,1) over (order by position)
end from_level,
to_product,
to_level,
total_qty,
case when total_qty is not null
then yield
end agg_yield
from (select position,
first_value(dmd_product ignore nulls) over (order by position) dmd_product,
from_product,
from_level,
to_product,
to_level,
case to_flag when 'Y'
then total_qty -
lag(total_qty,1) over (order by position) +
lead(qty,1) over (order by position)
end total_qty,
case when to_flag = 'Y'
and lead(to_flag,1) over (order by position) = 'N'
then yield
else yield * lead(yield,1) over (order by position) / 100
end yield,
from_flag,
to_flag
from (select position,
case when req_flag = 'Y'
and position = (select min(position)
from test
where req_flag = 'Y'
then prod
end dmd_product,
prod from_product,
l_level from_level,
req_flag from_flag,
lead(prod,1) over (order by position) to_product,
lead(l_level,1) over (order by position) to_level,
lead(req_flag,1) over (order by position) to_flag,
qty,
sum(qty) over (order by position) total_qty,
last_value(nullif(yield,100) ignore nulls) over (order by position) yield
from test
where from_flag != 'N'
or to_flag != 'N'
where dmd_product is not null
where from_product is not null
order by position
DMD_PRODUCT
FROM_PRODUCT
FROM_LEVEL
TO_PRODUCT
TO_LEVEL
TOTAL_QTY
AGG_YIELD
99904228
99904228
LEVEL_1
66500084
LEVEL_3
4
92
99904228
66500084
LEVEL_3
47418545
LEVEL_4
2
90
99904228
47418545
LEVEL_4
35264044
LEVEL_6
4
97.02
Regards
Etbin -
Need help - select data from NCLOB column problem
Hi,
Im having problem retrieving data from NCLOB columns via ODBC. After SQLExecdirect on my SELECT statement call to SQLFetch gives me following error:
ORA-24806 LOB form mismatch
I tried following two ways of data retrieval:
SQLExecDirect(hstmt,(SQLTCHAR*)szSQLStatement,SQL_NTS);
SQLBindCol(hstmt,3,SQL_C_TCHAR,chBuffer,sizeof(chBuffer),&iDataLen);
SQLFetch(hstmt);
OR
SQLExecDirect(hstmt,(SQLTCHAR*)szSQLStatement,SQL_NTS);
SQLFetch(hstmt);
SQLGetData(hstmt,3,SQL_C_TCHAR,chBuffer,sizeof(chBuffer),&iDataLen);
Both times call to SQLFetch gives me ORA-24806 LOB form mismatch error.
INSERT and UPDATE for this table works just fine.
If I change NCLOB type to CLOB works just fine, but I will be storing Unicode data, so using CLOB cant be a solution
Any ideas appreciated.
Thanks in advance,
Vlad
Server:
Oracle 9.2 database on Windows 2000 Server
NLS_LANGUAGE = AMERICAN
NLS_TERRITORY = AMERICA
NLS_CHARACTERSET = WE8MSWIN1252
NLS_NCHAR_CHARACTERSET = AL16UTF16
Client:
Unicode C++ application, connects via Oracle 9.2 ODBC driver on Windows XP
NLS_LANG = AMERICAN_AMERICA.WE8MSWIN1252
CREATE TABLE my_nclob_table (
id number (10,0) NOT NULL ,
name nvarchar2 (255) NOT NULL ,
description nvarchar2 (255) NULL ,
definition nclob NOT NULL ,
creation date NOT NULL ,
lastmodified date NOT NULL ,
CONSTRAINT PK_cat_pricelist PRIMARY KEY
id
#define nil NULL
#define null NULL
#define SQL_ERR(__sqlerr__) (((__sqlerr__) != SQL_SUCCESS) && ((__sqlerr__) != SQL_SUCCESS_WITH_INFO))
#define STOP_IF_SQL_ERR(__sqlerr__) \
do \
if (SQL_ERR(__sqlerr__)) goto stop_; \
} while (false)
void eqTestOracleLOBSelect(void)
SQLHENV henv = null;
SQLHDBC hdbc = null;
SQLHSTMT hstmt = null;
SQLRETURN retcode = SQL_SUCCESS;
TCHAR szSQLStatement[] = T("select id, name, definition from mynclob_table");
int iFetchedRows = 0;
TCHAR szMsg[512];
TCHAR chBuffer[2049];
SQLLEN iDataLen = 0;
try
retcode = eqOpenConnectionODBC(_T("myTestDsn"),_T("user"),_T("pwd"),henv,hdbc);
STOP_IF_SQL_ERR(retcode);
retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
STOP_IF_SQL_ERR(retcode);
retcode = SQLExecDirect(hstmt,(SQLTCHAR*)szSQLStatement,SQL_NTS);
STOP_IF_SQL_ERR(retcode);
retcode = SQLBindCol(hstmt,3,SQL_C_TCHAR,chBuffer,sizeof(chBuffer),&iDataLen);
STOP_IF_SQL_ERR(retcode);
while (retcode == SQL_SUCCESS)
retcode = SQLFetch(hstmt);
if (retcode == SQL_NO_DATA)
retcode = SQL_SUCCESS;
break;
STOP_IF_SQL_ERR(retcode);
// retcode = SQLGetData(hstmt,3,SQL_C_TCHAR,chBuffer,sizeof(chBuffer),&iDataLen);
// STOP_IF_SQL_ERR(retcode);
++iFetchedRows;
stop_:
if (SQL_ERR(retcode))
MessageBox(null,_T("SQL statement execution error."),_T("Error"),MB_OK);
eqShowStatementError(SQL_HANDLE_STMT,hstmt,retcode);
} else {
_stprintf(szMsg,_T("SQL execution success. Fetched rows: %ld"),iFetchedRows);
MessageBox(null,szMsg,_T("Success"),MB_OK);
catch(...)
MessageBox(null,_T("Unknown exception in eqTestOracleLOBSelect"),_T("Unknown exception"),MB_OK);
if (hstmt != null)
SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
hstmt = null;
if (hdbc != nil)
SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
hdbc = nil;
if (henv != nil)
SQLFreeHandle(SQL_HANDLE_ENV, henv);
henv = nil;
SQLRETURN eqOpenConnectionODBC(TCHAR *szDSN,
TCHAR *szUser,
TCHAR *szPassword,
SQLHENV &henv,
SQLHDBC &hdbc)
SQLRETURN retcode;
henv = nil;
hdbc = nil;
//Allocate environment handle
retcode = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
STOP_IF_SQL_ERR(retcode);
//Set the ODBC version environment attribute
retcode = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
STOP_IF_SQL_ERR(retcode);
// Allocate connection handle
retcode = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
STOP_IF_SQL_ERR(retcode);
// Set login timeout to 5 seconds.
SQLSetConnectAttr(hdbc, SQL_LOGIN_TIMEOUT, (void*)5, 0);
STOP_IF_SQL_ERR(retcode);
retcode = SQLConnect(hdbc, (SQLTCHAR*)szDSN, SQL_NTS,
(SQLTCHAR*)szUser, SQL_NTS,
(SQLTCHAR*)szPassword, SQL_NTS);
stop_:
if (SQL_ERR(retcode))
MessageBox(null,_T("Connection Error."),_T("Error"),MB_OK);
if (hdbc != nil)
eqShowStatementError(SQL_HANDLE_DBC, hdbc,retcode);
SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
hdbc = nil;
if (henv != nil)
eqShowStatementError(SQL_HANDLE_ENV, henv,retcode);
SQLFreeHandle(SQL_HANDLE_ENV, henv);
henv = nil;
} else MessageBox(null,_T("Connected."),_T("Success"),MB_OK);
return retcode;
void eqShowStatementError(SQLSMALLINT chHandleType, SQLHANDLE hHandle,long lErrOrig)
SQLRETURN nErr = SQL_SUCCESS;
int nRecNum = 1;
SQLTCHAR szSqlState[6];
SQLTCHAR szMsg[SQL_MAX_MESSAGE_LENGTH];
SQLSMALLINT nMsgLen;
SQLINTEGER nNativeError;
while ((nErr = SQLGetDiagRec(chHandleType,hHandle,nRecNum,
szSqlState, &nNativeError,
szMsg, sizeof(szMsg), &nMsgLen)) != SQL_NO_DATA)
szSqlState[5] = 0;
MessageBox(NULL,(const TCHAR *)szMsg,_T("ODBC Error"),MB_OK);
++nRecNum;Yes, the 9.2.0.2 driver can be downloaded from OTN. I don't believe it will solve your particular problem, but it will help in general. If you don't grab the latest version, you'll probably have to chack the "Force SQL_WCHAR Support" option in the DSN configuration.
From the help file
"The C data type, SQL_C_WCHAR, was added to the ODBC interface to allow applications to specify that an input parameter is encoded as Unicode or to request column data returned as Unicode. The macro SQL_C_TCHAR is useful for applications that need to be built as both Unicode and ANSI. The SQL_C_TCHAR macro compiles as SQL_C_WCHAR for Unicode applications and as SQL_C_CHAR for ANSI applications."
My first thought would be that your application is not being compiled as Unicode. If you substitute SQL_C_WCHAR for SQL_C_TCHAR when you're dealing with NCLOB columns, I suspect you'll have better luck.
More help file
"The SQL data types, SQL_WCHAR, SQL_WVARCHAR, and SQL_WLONGVARCHAR, were added to the ODBC interface to represent columns defined in a table as Unicode. These values are potentially returned from calls to SQLDescribeCol, SQLColAttribute, SQLColumns, and SQLProcedureColumns. In Oracle release 8.1.7.0.0 or 9.0.1.0.0, the Oracle database does not support encoding columns as Unicode. These values would not be returned from the ODBC Drivers for Oracle release 8.1.7.0.0 or for Oracle 9.0.1.0.0 databases.
In Oracle release 9.2.0.0.0, Unicode encoding was supported for SQL column types NCHAR, NVARCHAR2, and NCLOB. In addition, Unicode encoding was also supported for SQL column types CHAR and VARCHAR2 if the character semantics were specified in the column definition.
Starting with release 9.2.0.2.0, the ODBC Driver supports these SQL column types and maps NCHAR to the SQL data type SQL_WCHAR, NVARCHAR2 is mapped to SQL_WVARCHAR, and NCLOB is mapped to SQL_WLONGVARCHAR. The SQL CHAR column is mapped to SQL_WCHAR and the VARCHAR2 column is mapped to SQL_WVARCHAR if the character semantics are specified for the column. While the Force SQL_WCHAR Support option is still available in the 9.2.0.2.0 ODBC Driver, it is no longer required for Unicode support."
Justin -
Need Help with iTunes 11.0 Column Browser - PC
In the new version of iTunes 11.0, I can't seem to get three columns when using the column browser. I want to see Artists, Albums, and then Songs in that order, but it won't allow me to move the Songs panel as a column. I was able to do this with the older version of iTunes. This is a waste of screen space since the artists and albums don't require wide columns at all. What is up with Apple these days?
I'm using iTunes 11.0.2 on a 21" iMac that's 2 years old. Today iTunes started playing on it's own and it's never done that to me before. I had to Force Quit iTunes twice and I restarted my computer. As soon as I restarted my computer I did not open iTunes, but within 10 minutes it not only opened itself but it started playing. This is super frustrating and I need it to stop. Can anyone help?
-
Need help adding image to datagrid column
Hi,
Can anyone tell me how to add an image to a datagrid column?
I have created a flex library project which contains a mxml component with a datagrid, an item renderer mxml component which rendered the image within the datagrid column depending on the value coming back from the database for that column and a folder 'assets' which hold all the images. When I add the library to my main project and call the mxml component with the datagrid an image place holder is visible in the datagrid column but not the image. However, if I take the image out of the library project and added to an 'assets' folder in the main project the image is displayed in the datagrid column.
It looks like, even though the images are in the flex library project and only the flex library project is trying to display the images in the datagrid, the library project is looking in the main application project folder for the image.
Does anyone know why this is happening and how to fix it?
Thanks in advance for an help,
Xander.I have tried embedding the images in my library but it still didn't work. Also I can't embed the image as I'm using the value of the column to complete the image name, for example in my mxml item renderer component I have the added the following code
<mx:Image source="@Embed(source='assets/' + data.mycolumnvalue + '.png')" tooltip="{data.mycolumnvalue}"/>
but nothing is displayed. -
Need help with query for converting columns to rows
Hello,
I know this is a very common question asked in the forum. I have searched regading this, i did find some threads, but i was not able to achieve what i require from the answers posted. So anybody please help me.
I have a table which is having multiple columns as follows:
Insert into table_1 (X,Y,Z,A,B,C,D,E,F,G,H,I) values (0,0,2,0,0,1,3,0,0,0,0,0);I want to convert the result into a two column, multiple rows i.e., I want the result as follows:
Col1 Col2
X 0
Y 0
Z 2
A 0
B 0
C 1
D 3
E 0
F 0
G 0
H 0
I 0Please anybody help me in writing the query for this..Is this what you are expecting:
SQL> WITH T AS
2 (
3 SELECT 0 X, 0 Y, 2 Z, 0 A, 0 B, 1 C, 3 D, 0 E, 0 F, 0 G, 0 H, 0 I FROM DUAL
4 )
5 SELECT 'X' col1, X col2 FROM T
6 UNION ALL
7 SELECT 'Y' col1, Y col2 FROM T
8 UNION ALL
9 SELECT 'Z' col1, Z col2 FROM T
10 UNION ALL
11 SELECT 'A' col1, A col2 FROM T
12 UNION ALL
13 SELECT 'B' col1, B col2 FROM T
14 UNION ALL
15 SELECT 'C' col1, C col2 FROM T
16 UNION ALL
17 SELECT 'D' col1, D col2 FROM T
18 UNION ALL
19 SELECT 'E' col1, E col2 FROM T
20 UNION ALL
21 SELECT 'F' col1, F col2 FROM T
22 UNION ALL
23 SELECT 'G' col1, G col2 FROM T
24 UNION ALL
25 SELECT 'H' col1, H col2 FROM T
26 UNION ALL
27 SELECT 'I' col1, I col2 FROM T
28 /
C COL2
X 0
Y 0
Z 2
A 0
B 0
C 1
D 3
E 0
F 0
G 0
H 0
C COL2
I 0
12 rows selected. -
Need Help in Pivot of the Columns in Oracle 9i
Hi,
I have a requirement where-in i need to generate the output as below:<<under EXP1 we need to populate the SUM amounts for each category i.e. group by No and Category>>
No Vessel EXP1 EXP2 EXP3 EXP3 .....
1 TEST 10 -8 100 0
2 TEST 11 0 90 -17
And the Code I am using for the same as below:
SELECT Vessel_Code,
dano,
join(cursor(select 'SUM(DECODE(ExpenseCategory,'||''''||expensecategory||''''||',GroupAmount,NULL))'||' '||expensecategory
from linetypes
where ExpenseCategory NOT IN ('ADV','BANKCHARGES','GAIN/LOSS','NONAGENT')
and ExpenseCategory NOT LIKE 'REBILLABLE%'
and ExpenseCategory NOT LIKE 'SPECIFIED%'
group by expensecategory))
FROM
(select a.Vessel_Code
, NVL(a.ParentDANo,a.DA_NO) as dano
, b.ExpenseCategory
, sum(NVL(FinalDAAMount,0)+NVL(supplmnt_amount,0)) as GroupAmount
from da_head a
Cross Join LineTypes b
Left Join DA_Detail c
On a.DA_No = c.DA_No
and a.Credit_Status = c.Credit_Status
and b.DALineTypeId = c.DA_LINETYPE_ID
where status in ('P','G')
and b.ExpenseCategory NOT IN ('ADV','BANKCHARGES','GAIN/LOSS','NONAGENT')
and b.ExpenseCategory NOT LIKE 'REBILLABLE%'
and b.ExpenseCategory NOT LIKE 'SPECIFIED%'
Group by a.Vessel_Code
, NVL(a.ParentDANo,a.DA_NO)
, b.ExpenseCategory
Union
select a.Vessel_Code
, NVL(a.ParentDANo,a.DA_NO) as dano
, SUBSTR(b.ExpenseCategory,0,Length(b.ExpenseCategory)-1) as ExpenseCategory
, sum(NVL(FinalDAAMount,0)+NVL(supplmnt_amount,0)) as GroupAmount
from da_head a
Cross Join LineTypes b
Left Join DA_Detail c
On a.DA_No = c.DA_No
and a.Credit_Status = c.Credit_Status
and b.DALineTypeId = c.DA_LINETYPE_ID
where status in ('P','G')
and b.ExpenseCategory NOT IN ('ADV','BANKCHARGES','GAIN/LOSS','NONAGENT')
and b.ExpenseCategory LIKE 'SPECIFIED%'
Group by a.Vessel_Code
, NVL(a.ParentDANo,a.DA_NO)
, SUBSTR(b.ExpenseCategory,0,Length(b.ExpenseCategory)-1)
Union
select a.Vessel_Code
, NVL(a.ParentDANo,a.DA_NO) as dano
, SUBSTR(b.ExpenseCategory,0,Length(b.ExpenseCategory)-1) as ExpenseCategory
, sum(NVL(FinalDAAMount,0)+NVL(supplmnt_amount,0)) as GroupAmount
from da_head a
Cross Join LineTypes b
Left Join DA_Detail c
On a.DA_No = c.DA_No
and a.Credit_Status = c.Credit_Status
and b.DALineTypeId = c.DA_LINETYPE_ID
where status in ('P','G')
and b.ExpenseCategory NOT IN ('ADV','BANKCHARGES','GAIN/LOSS','NONAGENT')
and b.ExpenseCategory LIKE 'REBILLABLE%'
Group by a.Vessel_Code
, NVL(a.ParentDANo,a.DA_NO)
, SUBSTR(b.ExpenseCategory,0,Length(b.ExpenseCategory)-1)
GROUP BY Vessel_Code,
dano
order by dano;The reason why I have been using the join(cursor(.....) to get the result set as :
SUM(DECODE(ExpenseCategory,'OWNER',GroupAmount,NULL)) OWNER,
SUM(DECODE(ExpenseCategory,'CTM',GroupAmount,NULL)) CTM,
SUM(DECODE(ExpenseCategory,'PORT',GroupAmount,NULL)) PORT,
SUM(DECODE(ExpenseCategory,'REBILLABLE',GroupAmount,NULL)) REBILLABLE,
SUM(DECODE(ExpenseCategory,'SPECIFIED',GroupAmount,NULL)) SPECIFIED,
SUM(DECODE(ExpenseCategory,'CARGO',GroupAmount,NULL)) CARGO,
SUM(DECODE(ExpenseCategory,'ACCTTEMP',GroupAmount,NULL)) ACCTTEMPAs we don't know the exact number of expense categories to be displayed I have used cursor excluding the expense categories I don't need.When I run the same as individual query I get the correct result but when I execute it along with the query I get error maximum cursors open exceeded...
Please let me know how can it be achieved.
Any suggestions are welcome.
Thanks,
HemanthThe easiest way to do this, and it could be done in a few minutes, would be to move to a currently supported version of Oracle, 11gR1 or 11gR2, where we have the PIVOT and UNPIVOT operators.
In the desupported version you have the best choice is to hit http://asktom.oracle.com and look up the solution he published there some years ago.
I don't have the link so you can find it as fast as I can but look under "pivot" and "crosstab." -
Need help setting up rows and columns for a shop page in DW
I sell my books and design tees on my site. I'm trying to set up a new page for a new site.
For some reason I can't get my products in a row and column fashion.
I have a attachment file so you can see what I actually mean. thanks to all that will give advice.Use a table for your product catalog.
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
www.alt-web.com/
www.twitter.com/altweb
www.alt-web.blogspot.com -
Need Help in Next value of column to another column
Hi,
I am creating view in oracle 10g in which i have 1 custom column who's value are the next value of the another column.
E.g.
C 1 -----C2 ------ custom-C3
10 -------1 --------------2
10 ------ 2 ------------- 3
10 -------3 ------------- 3
11 -------1 ------------- 2
Now is there any function in oracle which gives me to generate "custom-c3"
which gives the data for next value of column 2
Thanks.Hi Frank,
Thank you so much......its working fine in 10 g.....
but for the last row of its coming emply or null but i want value of c2 if its last value.
e.g
C 1 -----C2 ------ custom-C3
10 -------1 --------------2
10 ------ 2 ------------- 3
10 -------3 ------------- 3
11 -------1 ------------- 2
In the above the value of c1 is 10 i.e last one then value of c3 should be value of c2 i.e. 3.
Can you use IF function?
Thanks.
Message was edited by:
user650690 -
Need help on new calculated item column
Hi Guys,
Could you please help me with the formula on a new calculated item on the attached report?
Details on the screen shot of the link
http://img339.imageshack.us/img339/5606/70548266.jpg
Thanks and Regards
G.Nikkolas wrote:
i found dv5-1251nr with 512 megs dedicated nvidia graphics ( NVIDIA GeForce 9200M GS) Intel Core 2 Duo Processor T6400 4 gigs ram 320 hd for 849 now i tested this system with battery in
6 cell on balanced mode internet surfing, looping a 3 min video clip, 3 other windows open including chess and the 3d game fate and battery that was 100% dropped to 75% after 30 mins, so if i figured it out right means battery lasts for about 2 hours
this any good and whats deal with all the chips intel centrino, intel centrino 2 etc and i know amd athlon is old and turion is better but is it that much better?
Intel Core 2 Duo's are the most efficent, so if you are looking for good battery life, that is what you want. Avoid AMD as they eat the battery life quite quickly.
The battery life depends on what the computer is doing, so if you are stressing it with a lot of applications, yes the battery is going to die quicker than normal.
My opinions are mine, and mine alone. -
Need help on object type(complex)
Hi All,
i have an object type account_t as
create type account_t as object (accountnumber number(30),
holdername varchar2(20),
currentamount number(20),
minimalamount number(20),
status varchar2(10),
member procedure setcurrentamount(v_amount number),
member function getcurrentamount return number,
member procedure setstatus(v_status boolean),
member function getstatus return varchar2,
member procedure setholdername(v_holdername varchar2),
member function getholdername return varchar2);
i create another type accountmanager_t as
create type accountmanager_t as object (
depositamount number(30),
withdrawalamount number(30),
v_accountt account_t,
member function deposit(d_accountt account_t,d_transno number default 1) return account_t,
member function withdraw(w_accountt account_t,w_transno number default 2) return account_t);
Accountmanager_t body as :
create or replace type body accountmanager_t as
member function deposit(d_accountt account_t,d_transno number default 1) return account_t as
begin
return self.amount+self.depositamount;
end deposit;
member function withdraw(w_accountt account_t,w_transno number default 2) return account_t as
begin
if self.status='OPEN' then
if (currentamount-self.withdrawalamount) < minimalamount then
if (currentamount-self.withdrawalamount) <> 0 then
status:='CLOSED';
return self.currentamount-self.withdrawalamount;
end if;
end if;
myprint('No Sufficient funds for Withdrawal');
return self.currentamount;
end if;
myprint('No withdrawal for closed account');
return self.currentamount;
end withdraw;
end;
i get the errors as :
4/3 PL/SQL: Statement ignored
4/15 PLS-00302: component 'AMOUNT' must be declared
8/3 PL/SQL: Statement ignored
8/11 PLS-00302: component 'STATUS' must be declared
19/3 PL/SQL: Statement ignored
19/15 PLS-00302: component 'CURRENTAMOUNT' must be declared
SQL>
How to pass the values of these variables from account_t type to accountmanager_t type?
Any help??
Regards,
s.return self.amount+self.depositamount;I counld not find any amount field in your type definitions
if self.status='OPEN' thenIs it w_accountt.status ?? since there is no status field in accountmanager_t type
return self.currentamount-self.withdrawalamount;same comments for currentamount
member function deposit(d_accountt account_t,d_transno number default 1) return account_t asWhere as your return expression is a number??
Maybe you are looking for
-
How can i sync my outlook calendar with my Iphone
I was trying to import my contact list from my iphone to outlook 2003. There were no entries on outlook and over 800 on my iphone and it erase them all. How do I set up my itunes to sync and merge records in both directions without creating duplica
-
I have a band video that I want to edit. In iMove 09, I could clip to crop or add a transition or both without altering the audio. In iMovie 11, the audio lower or drops out when I clip for and use a transtion. Is there a setting to preven this?
-
QT 7 - not compatible with older PC games?
My kids have an older (04?) Disney PC game which requires QT 4.0 or greater. As soon as we downloaded QT 7, the game no longer worked. A note pops up that we are required to have QT 4 or greater - although QT 7 is already on the machine! Any ideas? S
-
Hi, Is Planned order profile for REM needs to configured for Planned Order type PE in IMG(T Code OMDD). Thanks in Advance. Regards, PPcon
-
Hi we are creating rush order with immediate delivery, in the first time( at the time of creating VA01) after saving the sales order system creating immediate delivery(autimatically) but in the change mode(VA02) if we add any new line item for that s