Numeric and Non Numeric Data
Hi,
I have to check the data in Varchar2 field idtr and if it is numeric some actions are to be done on the data and if it is numeric some other different action is to be done.
So I used some logic for finding whether the data is numeric or non numeric which I got it from the net.
Now my problem is all decimal numbers are to be treated as numeric but this logic is treating decimals as non numeric and I am not able to proceed further.
Can some one help me out in this issue.
Below is the Logic and actions I am doing
select pol_id,lpad(substr(trunc(to_number(idtr),0),1,10),10,0),idtr
from pl_insrd
where length(idtr) - length(translate(idtr,chr(1)||translate(idtr,CHR(1)||'1234567890',CHR(1) ),CHR(1) ) ) = 0
and length(idtr) > 9
UNION
select pol_id,lpad(trunc(idtr,0),10,0),idtr
from pl_insrd
where length(idtr) - length(translate(idtr,chr(1)||translate(idtr,CHR(1)||'1234567890',CHR(1) ),CHR(1) ) ) = 0
and length(idtr) < 10
UNION
select pol_id,substr(idtr,1,10),idtr
from pl_insrd
where length(idtr) - Length(TRANSLATE(idtr,CHR(1)||TRANSLATE(idtr,CHR(1)||'1234567890', CHR(1) ), CHR(1) ) ) > 0
and length(idtr) > 9
UNION
select pol_id,lpad(idtr,10,0),idtr
from pl_insrd
where length(idtr) - Length(TRANSLATE(idtr,CHR(1)||TRANSLATE(idtr,CHR(1)||'1234567890', CHR(1) ), CHR(1) ) ) > 0
and length(idtr) < 10
<quote>One I provided was I found at asktom.oracle.com</quote>
So? ... If you'd provided a link then one could see the entire context for that particular snippet of code and decide if it is indeed appropriate. As shown by Angus it is not always appropriate ... add to that, NULL is not a number as that function reports.
<quote>It's using replace and transalate functions which are less expensive then To_Number function.</quote>
Proof?
<quote>I agree with you [John], that's the best function you can use to validate data for numeric.<quote>
I don't agree to_number() is [always] the best way ... the easiest way? ... maybe.
My personal view is that there is no universal way to determine if a string, in all circumstances, can be translated into a number. One has to have knowledge of the source data domain ... only you know if, in your particular circumstance, '1e4' is or is not a NUMBER represented as a string.
flip@FLOP> select to_number('1e3') from dual;
TO_NUMBER('1E3')
1000
Similar Messages
-
Retrieving spatial and non spatial data in one query
Hello. I am having slight difficulties using JDBC to retrieve both spatial and non spatial data in the same query. The following is code from a sample program of mine that retrives spatial data from spatial tables.
(In spatialquery geom is a geometry column and city is simply the name of the city):
try
Geometry geom = null;
String database = "jdbc:oracle:thin:@" + m_host + ":" + m_port + ":" + m_sid;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
con = (OracleConnection)DriverManager.getConnection(database, sUsername, sPassword);
GeometryAdapter sdoAdapter =
OraSpatialManager.getGeometryAdapter("SDO", "8.1.7", STRUCT.class, null, null, con);
String spatialquery = "SELECT a1.geom, a1.city \n" +
"FROM cities a1";
Statement stmt = con.createStatement();
OracleResultSet rs = (OracleResultSet) stmt.executeQuery(spatialquery);
int i = 0;
int noOfFeatures = 2;
while (rs.next())
for(i = 1; i <= noOfFeatures; i++)
STRUCT dbObject = (STRUCT)rs.getObject(i);
try
geom = sdoAdapter.importGeometry(dbObject);
catch(GeometryInputTypeNotSupportedException e)
System.out.println("Input Type not supported");
catch(InvalidGeometryException e)
System.out.println("Invalid geometry");
System.out.println(geom);
}//end while loop
This retrieves the sptial data fine, however when I attempt to retreive the non-spatial data I keep getting a "ClassCastException" error. I understand it is something to do with "STRUCT dbObject = (STRUCT)rs.getObject(i);" line. Can anyone tell me how to retrieve both spatial and non-spatial data in the one query using JDBC. I have tried nearly everything at this stage. Cheers joeTheresa A Radke
Posts: 20
OTN Member Since: Jul, 2001
retrieving spatial and non spatial in same query. May 23, 2003 12:02 AM
retrieving spatial and non spatial in same query. -
SAP and Non-SAP data to Xcelsius
Hi Experts,
I m new to Xcelsius and i a m currently working on Xcelsius project, i need help on approach to bring both SAP and Non-SAP data to Xcelsius. Here the scenario goes on....
Total 6 plants are there, out of 6, 4 plants are on SAP and other 2 plants are on Non-SAP (Excel)
The requirement is to develop a dashboard to see all the plants details (both SAP and Non-SAP)
The approach i suggested for SAP: ECC --> BW --> InfoProvider --> Query --> QaaWS --> Xcelsius
For non-sap, data is available in excel, so we can bring that data directly to xcelsius, but problem is how to make it dynamaic because data in excel changes daily.
So my doubt is, if i develop a universe on excel files, then how to combine both SAP and Non-SAP universes. Is Data Federator is required for this or is there any approach to bring both SAP and Non-SAP data to Xcelsius.
Can any one help me on this
Thanks & Regards
Ramakrishna Kamurthyhi
Another approach which i have used in the past is to have data in XML format, placed on a web server. When my data changes daily, i just export my data from excel or whatever source into the XML format..
Use the XML data connector to bring into xcelsius.
thanks.. hope this helps
regards
Jeff. -
JAX-RPC and non-primitive data types
Hello all!
I am using JWSDP v1.3 and i have a problem using non-primitive data types as return types for my operations.
Consider the helloservice example of the JWSDP1.3 tutorial. Now suppose that instead of having the simple operation sayHello() that returns a String, we execute a query on a database, get some ResultSetMetaData and we want these Metadata to be the return type of our operation. I.e. have the operation
public ResultSetMetaData sayHello()
instead of the
public String sayHello()
of the tutorial.
When trying to build the service i get the following error which is normal, because ResultSetMetaData is not a supported JAX-RPC type.
run-wscompile: [echo] Running wscompile: [echo] C:\jwsdp\apache-ant\../jaxrpc/bin/wscompile.bat -define -d build - nd build -classpath build config-interface.xml -model build/model. gz [exec] error: invalid type for JAX-RPC structure: java.sql.ResultSetMetaData [exec] Result: 1
Is there any way to define an operation like this? Can i specify somehow ResultSetMetaData as a supported-type?
I hope someone can give me some advice on it, because i have lost one evening trying to figure it out myself :)
Regards,
KostasCourtesy links to crossposts so people don't waste their time answering a question which has already been answered
http://forum.java.sun.com/thread.jsp?thread=482875&forum=59&message=2253704
http://forum.java.sun.com/thread.jsp?thread=482873&forum=331&message=2253699 -
Re: Segregate leading and non-leadingledger data in BI Cube
Hello,
I would like to share the following Scenario with you all:
I want to extract leading ledger and non-leading ledger data into a BI cube. Sure, the answer is yes.
Would it be possible to segregate both leading and non-leading ledger data within a BI cube? Or the only possibility is to load leading and non-leading ledger data into two different cubes?
Please advise.
Thanks
RJHi RJ,
Depending on what datasource you are using, it will provide a field that indicates the ledger. The new general ledger datasources provide the field RLDNR for this purpose, and you'll need to make sure to carry through this value to the BW DSO or Cube that you are using - [http://help.sap.com/saphelp_bic706sp01/helpdata/en/45/757140723d990ae10000000a155106/frameset.htm]
Cheers,
Ethan -
Question about DBMS_PREDICTIVE_ANALYTICS and non-linear data
Hi,
I am executing DBMS_PREDICTIVE_ANALYTICS against some data, but it's not giving me good predictions for my null data. Should I be using different data mining techniques ?
The data has the following fields 1) Position, 2) Odds, 3) Selection & 4) Event.
Position and Odds and linear, since the smaller the number the higher the likelihood of winning, but Selection is a lookup based on a Name, so therefore non-linear, but can be used to look at previous form in the same data set. Event is a way to group Selection's into an Event.
What's the best way to tackle this ?Sorry for delay, been on vacation.
I'm trying to improve odds for predicting winners, given the form, odds, previous history, and form of other runners in the race.
Take a look at data.betfair.com for a list of data elements available to me.
I'm currently using the data where the latest_taken column has the highest value. i.e. the odds and ranking just before the race starts. -
How to create XA and non XA data source in Jdeveloper?
I wonder if somebody can help me with this:
I need step by step guidance how to create
1) Oracle data source without transaction support
2) Oracle data source with XA transaction support
for both embedded OC4J and standalone OC4J. I am using JDeveloper 9i
thanks,For non XA datasource create a JDBC Connection with data source class
oracle.jdbc.pool.OracleDataSource
For xa datasource create a JDBC connection with data source class
oracle.jdbc.xa.client.OracleXADataSource -
Table with bith dynamic and non dynamic data
Hi all,
We have a report already developed. Now we need add some fields from some table which is dynamic in feature to the final report which is already there.
I need to know how come we can include the dynamic fields into the final internal table.
I tried declaring fieldsymbols inside the data stmt of the final internal table but it shows some syntax error.
Please help me.
ThanksCheck this sample code..
REPORT ztest_dynamic_code.
DATA: BEGIN OF it_tab OCCURS 0,
abc(3),
xyz(3),
pqr(3),
item,
END OF it_tab.
DATA: it_fieldcatalog TYPE lvc_t_fcat,
wa_fieldcat TYPE lvc_s_fcat.
DATA: i_dyntab TYPE REF TO data. " To create dyn.Itab
DATA:
w_dref TYPE REF TO data,
ind(2) TYPE n,
w_data TYPE REF TO data,
w_text(5),
w_grid TYPE REF TO cl_gui_alv_grid.
DATA: grid TYPE REF TO cl_gui_alv_grid,
cont TYPE REF TO cl_gui_custom_container.
FIELD-SYMBOLS: <t_itab> TYPE STANDARD TABLE,
<fs_wa> TYPE ANY,<fs> TYPE ANY.
DATA: in TYPE i.
*Data population
it_tab-abc = 'ABC'.
it_tab-xyz = 'XYZ'.
it_tab-pqr = 'PQR'.
DO 9 TIMES.
in = in + 1.
it_tab-item = in.
APPEND it_tab.
ENDDO.
*Field cat population.
wa_fieldcat-fieldname = 'ABC'.
wa_fieldcat-outputlen = 3.
wa_fieldcat-coltext = 'abc'.
APPEND wa_fieldcat TO it_fieldcatalog.
wa_fieldcat-fieldname = 'XYZ'.
wa_fieldcat-outputlen = 3.
wa_fieldcat-coltext = 'XYZ'.
APPEND wa_fieldcat TO it_fieldcatalog.
wa_fieldcat-fieldname = 'PQR'.
wa_fieldcat-outputlen = 3.
wa_fieldcat-coltext = 'pqr'.
APPEND wa_fieldcat TO it_fieldcatalog.
wa_fieldcat-fieldname = 'COLOR'.
wa_fieldcat-outputlen = 4.
wa_fieldcat-coltext = 'col'.
APPEND wa_fieldcat TO it_fieldcatalog.
ind = 1.
DO 9 TIMES.
CONCATENATE 'ITEM' ind INTO wa_fieldcat-fieldname.
CONCATENATE 'ITEM' ind INTO wa_fieldcat-coltext.
wa_fieldcat-outputlen = 1.
APPEND wa_fieldcat TO it_fieldcatalog.
CLEAR wa_fieldcat .
ind = ind + 1.
ENDDO.
*-Dynamic Table creation
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcatalog
IMPORTING
ep_table = i_dyntab.
ASSIGN i_dyntab->* TO <t_itab>.
CREATE DATA w_data LIKE LINE OF <t_itab>.
ASSIGN w_data->* TO <fs_wa>.
SORT it_tab BY abc xyz pqr.
CLEAR ind.
ind = 4.
*-Final Internal table as per Requirement
do 10 times.
LOOP AT it_tab.
ASSIGN COMPONENT 1 OF STRUCTURE <fs_wa> TO <fs>.
<fs> = it_tab-abc.
ASSIGN COMPONENT 2 OF STRUCTURE <fs_wa> TO <fs>.
<fs> = it_tab-xyz.
UNASSIGN <fs>.
ASSIGN COMPONENT 3 OF STRUCTURE <fs_wa> TO <fs>.
<fs> = it_tab-pqr.
UNASSIGN <fs>.
ASSIGN COMPONENT 4 OF STRUCTURE <fs_wa> TO <fs>.
*-You can assign the color conditionally also..
if sy-index = 4.
<fs> = 'C400'.
else.
<fs> = 'C600'.
endif.
UNASSIGN <fs>.
ASSIGN COMPONENT ind OF STRUCTURE <fs_wa> TO <fs>.
<fs> = it_tab-item.
UNASSIGN <fs>.
ind = ind + 1.
AT END OF pqr.
APPEND <fs_wa> TO <t_itab>.
* <fs_wa>-color = 'C600'.
ind = 4.
CLEAR <fs_wa>.
ENDAT.
ENDLOOP.
enddo.
*-Display
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
DATA: layout TYPE lvc_s_layo.
CREATE OBJECT cont
EXPORTING
container_name = 'CONT'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CREATE OBJECT grid
EXPORTING
i_parent = cont
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
layout-INFO_FNAME = 'COLOR'.
grid->set_table_for_first_display(
EXPORTING
is_layout = layout
CHANGING
it_outtab = <t_itab>
it_fieldcatalog = it_fieldcatalog
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT -
When I try to review a page, I get a message that some of the info is encrypted and some isn't, then it only shows half the information. how do I get it to show all thee info on the page?
Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
*Don't make any changes on the Safe mode start window.
*https://support.mozilla.com/kb/Safe+Mode
*https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes -
Unicode and non-unicode string data types Issue with 2008 SSIS Package
Hi All,
I am converting a 2005 SSIS Package to 2008. I have a task which has SQL Server as the source and Oracle as the destination. I copy the data from a SQL server view with a field nvarchar(10) to a field of a oracle table varchar(10). The package executes fine
on my local when i use the data transformation task to convert to DT_STR. But when I deploy the dtsx file on the server and try to run from an SQL Job Agent it gives me the unicode and non-unicode string data types error for the field. I have checked the registry
settings and its the same in my local and the server. Tried both the data conversion task and Derived Column task but with no luck. Pls suggest me what changes are required in my package to run it from the SQL Agent Job.
Thanks.What is Unicode and non Unicode data formats
Unicode :
A Unicode character takes more bytes to store the data in the database. As we all know, many global industries wants to increase their business worldwide and grow at the same time, they would want to widen their business by providing
services to the customers worldwide by supporting different languages like Chinese, Japanese, Korean and Arabic. Many websites these days are supporting international languages to do their business and to attract more and more customers and that makes life
easier for both the parties.
To store the customer data into the database the database must support a mechanism to store the international characters, storing these characters is not easy, and many database vendors have to revised their strategies and come
up with new mechanisms to support or to store these international characters in the database. Some of the big vendors like Oracle, Microsoft, IBM and other database vendors started providing the international character support so that the data can be stored
and retrieved accordingly to avoid any hiccups while doing business with the international customers.
The difference in storing character data between Unicode and non-Unicode depends on whether non-Unicode data is stored by using double-byte character sets. All non-East Asian languages and the Thai language store non-Unicode characters
in single bytes. Therefore, storing these languages as Unicode uses two times the space that is used specifying a non-Unicode code page. On the other hand, the non-Unicode code pages of many other Asian languages specify character storage in double-byte character
sets (DBCS). Therefore, for these languages, there is almost no difference in storage between non-Unicode and Unicode.
Encoding Formats:
Some of the common encoding formats for Unicode are UCS-2, UTF-8, UTF-16, UTF-32 have been made available by database vendors to their customers. For SQL Server 7.0 and higher versions Microsoft uses the encoding format UCS-2 to store the UTF-8 data. Under
this mechanism, all Unicode characters are stored by using 2 bytes.
Unicode data can be encoded in many different ways. UCS-2 and UTF-8 are two common ways to store bit patterns that represent Unicode characters. Microsoft Windows NT, SQL Server, Java, COM, and the SQL Server ODBC driver and OLEDB
provider all internally represent Unicode data as UCS-2.
The options for using SQL Server 7.0 or SQL Server 2000 as a backend server for an application that sends and receives Unicode data that is encoded as UTF-8 include:
For example, if your business is using a website supporting ASP pages, then this is what happens:
If your application uses Active Server Pages (ASP) and you are using Internet Information Server (IIS) 5.0 and Microsoft Windows 2000, you can add "<% Session.Codepage=65001 %>" to your server-side ASP script.
This instructs IIS to convert all dynamically generated strings (example: Response.Write) from UCS-2 to UTF-8 automatically before sending them to the client.
If you do not want to enable sessions, you can alternatively use the server-side directive "<%@ CodePage=65001 %>".
Any UTF-8 data sent from the client to the server via GET or POST is also converted to UCS-2 automatically. The Session.Codepage property is the recommended method to handle UTF-8 data within a web application. This Codepage
setting is not available on IIS 4.0 and Windows NT 4.0.
Sorting and other operations :
The effect of Unicode data on performance is complicated by a variety of factors that include the following:
1. The difference between Unicode sorting rules and non-Unicode sorting rules
2. The difference between sorting double-byte and single-byte characters
3. Code page conversion between client and server
Performing operations like >, <, ORDER BY are resource intensive and will be difficult to get correct results if the codepage conversion between client and server is not available.
Sorting lots of Unicode data can be slower than non-Unicode data, because the data is stored in double bytes. On the other hand, sorting Asian characters in Unicode is faster than sorting Asian DBCS data in a specific code page,
because DBCS data is actually a mixture of single-byte and double-byte widths, while Unicode characters are fixed-width.
Non-Unicode :
Non Unicode is exactly opposite to Unicode. Using non Unicode it is easy to store languages like ‘English’ but not other Asian languages that need more bits to store correctly otherwise truncation will occur.
Now, let’s see some of the advantages of not storing the data in Unicode format:
1. It takes less space to store the data in the database hence we will save lot of hard disk space.
2. Moving of database files from one server to other takes less time.
3. Backup and restore of the database makes huge impact and it is good for DBA’s that it takes less time
Non-Unicode vs. Unicode Data Types: Comparison Chart
The primary difference between unicode and non-Unicode data types is the ability of Unicode to easily handle the storage of foreign language characters which also requires more storage space.
Non-Unicode
Unicode
(char, varchar, text)
(nchar, nvarchar, ntext)
Stores data in fixed or variable length
Same as non-Unicode
char: data is padded with blanks to fill the field size. For example, if a char(10) field contains 5 characters the system will pad it with 5 blanks
nchar: same as char
varchar: stores actual value and does not pad with blanks
nvarchar: same as varchar
requires 1 byte of storage
requires 2 bytes of storage
char and varchar: can store up to 8000 characters
nchar and nvarchar: can store up to 4000 characters
Best suited for US English: "One problem with data types that use 1 byte to encode each character is that the data type can only represent 256 different characters. This forces multiple
encoding specifications (or code pages) for different alphabets such as European alphabets, which are relatively small. It is also impossible to handle systems such as the Japanese Kanji or Korean Hangul alphabets that have thousands of characters."<sup>1</sup>
Best suited for systems that need to support at least one foreign language: "The Unicode specification defines a single encoding scheme for most characters widely used in businesses around the world.
All computers consistently translate the bit patterns in Unicode data into characters using the single Unicode specification. This ensures that the same bit pattern is always converted to the same character on all computers. Data can be freely transferred
from one database or computer to another without concern that the receiving system will translate the bit patterns into characters incorrectly.
https://irfansworld.wordpress.com/2011/01/25/what-is-unicode-and-non-unicode-data-formats/
Thanks Shiven:) If Answer is Helpful, Please Vote -
Hi,
We are migrating our geodatabase from oracle 9i to 11g R2, in our current 9i DB we have same schema for spatial and non spatial data,we want to seperate the spatial and non spatial data during migration to 11gR2 DB.Is there any way through which we can extract only non spatial data and can import it to new schema without loosing any relationships/data.
Regards,Hi
Do you wants to separate the spatial data and non spatial data into two different table spaces or two different schema ?. if you're trying to move non spatial data to a different schema then definitely you need to do some changes . at least create some synonyms with appropriate grants to work normal.
if you wants to move it to a different table space then it's easy .
*1. Create the tables definition for non spatial data related table using new tablespace*
*2. grant the realted user the quota on the new tablespace*
*3. start the import using ignore=Y*
Cheers
Kanchana. -
Primitive v/s Non-primitive data type
Hi,
I am new to java. What is the difference between primitive and non-primitive data type?hi Anand,
there are hundred thousands of object in the Data Dictionary, so 15 won't harm much On the other hand, if you build up an ALV list based on this table, than it is good that you have these texts there with translations, etc.
hope this helps
ec -
Holding invoice based on PO and non-PO using BDC
Hello Everybody,
Please give me some solution regarding this While I am Keeping an ivoice in hold position using BDC (because I am getting the po and non-po data details from other system ) I am able to get an Invoice number for held Invoice but it is
according to Company Code that has been set in MIRO transaction if I am taking vendor details that has been not defined in
the set Companycode than I am not able to hold an invoice. Please tell me what I should do to avoid this problem ?
Thanks
SamirHi,
goto SPRO
IMG > MM > invoice verification > incoming Invoices >set check for duplicate invoices
check all the three options
Hope will help
Regards -
How do I take two separate non numeric fields in a acrobat form and combine the data to display in a third separate field?
You have to use custom JavScripting to concatenate the first 2 fields. You cannot use the first 2 calculation options because they force the values of the fields to a numeric value or ignore string values.
Possible scripts for the 3rd field are:
event.value = this.getField("Text1").valueAsString + " " + this.getField("Text2").valueAsString;
or
event.value = this.getField("Text1").valueAsString.concat( " ", this.getField("Text2").valueAsString);
If you do not want change the separator or not show the separator when on or the other field is empty, you will need to add more code to adjust for change.
The above scripts will also concatenate number because the field values are read as strings and not numbers.
There is also a generalized user written function to concatenate up to 3 fields with a separator that adjust for missing data. -
Using MODEL clause and COUNT for not numeric data columns....
Hi ,
Is it possible somehow to use the COUNT function to transform a non-numeric data column to a numeric data value (a counter) and be used in a MODEL clause....????
For example , i tried the following in the emp table of SCOTT dataschema with no desired result...
SQL> select deptno , empno , hiredate from emp;
DEPTNO EMPNO HIREDATE
20 7369 18/12/1980
30 7499 20/02/1981
30 7521 22/02/1981
20 7566 02/04/1981
30 7654 28/09/1981
30 7698 01/05/1981
10 7782 09/06/1981
20 7788 18/04/1987
10 7839 17/11/1981
30 7844 08/09/1981
20 7876 21/05/1987
30 7900 03/12/1981
20 7902 03/12/1981
10 7934 23/01/1982
14 rows selected Now , i want to use the MODEL clause in order to 'predict' the number of employees who were going to be hired in the 1990 per deptno...
So , i have constructed the following query which , as expected, does not return the desired results....
SQL> select deptno , month , year , count_
2 from
3 (
4 select deptno , to_number(to_char(hiredate,'mm')) month ,
5 to_number(to_char(hiredate , 'rrrr')) year , count(ename) count_
6 from emp
7 group by deptno , to_number(to_char(hiredate,'mm')) ,
8 to_number(to_char(hiredate , 'rrrr'))
9 )
10 model
11 partition by(deptno)
12 dimension by (month , year)
13 measures (count_ )
14 (
15 count_[1,1990]=count_[1,1982]+count_[11,1982]
16 )
17 /
DEPTNO MONTH YEAR COUNT_
30 5 1981 1
30 12 1981 1
30 2 1981 2
30 9 1981 2
30 1 1990
20 4 1987 1
20 5 1987 1
20 4 1981 1
20 12 1981 1
20 12 1980 1
20 1 1990
10 6 1981 1
10 11 1981 1
10 1 1982 1
10 1 1990 As you see , the measures for the 1990 year is null...because the measure(the count(deptno)) is computed via the group by and not by the MODEL clause...
How should i transform the above query... so as the "count_[1,1982]+count_[11,1982]" will return non-null results per deptno...????
Thanks , a lot
SimonConnected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL>
SQL> SELECT department_id, MONTH, YEAR, count_
2 FROM (SELECT e.department_id
3 ,to_number(to_char(e.hire_date, 'mm')) MONTH
4 ,to_number(to_char(e.hire_date, 'rrrr')) YEAR
5 ,COUNT(e.first_name) count_
6 FROM employees e
7 WHERE e.department_id = 20
8 GROUP BY e.department_id
9 ,to_number(to_char(e.hire_date, 'mm'))
10 ,to_number(to_char(e.hire_date, 'rrrr')));
DEPARTMENT_ID MONTH YEAR COUNT_
20 8 1997 1
20 2 1996 1
SQL> --
SQL> SELECT department_id, MONTH, YEAR, count_
2 FROM (SELECT e.department_id
3 ,to_number(to_char(e.hire_date, 'mm')) MONTH
4 ,to_number(to_char(e.hire_date, 'rrrr')) YEAR
5 ,COUNT(e.first_name) count_
6 FROM employees e
7 WHERE e.department_id = 20
8 GROUP BY e.department_id
9 ,to_number(to_char(e.hire_date, 'mm'))
10 ,to_number(to_char(e.hire_date, 'rrrr')))
11 model
12 PARTITION BY(department_id)
13 dimension BY(MONTH, YEAR)
14 measures(count_)(
15 count_ [1, 1990] = count_ [2, 1996] + count_ [8, 1997]
16 );
DEPARTMENT_ID MONTH YEAR COUNT_
20 8 1997 1
20 2 1996 1
20 1 1990 2
SQL> ---
SQL> SELECT department_id, MONTH, YEAR, count_
2 FROM (SELECT e.department_id
3 ,to_number(to_char(e.hire_date, 'mm')) MONTH
4 ,to_number(to_char(e.hire_date, 'rrrr')) YEAR
5 ,COUNT(e.first_name) count_
6 FROM employees e
7 GROUP BY e.department_id
8 ,to_number(to_char(e.hire_date, 'mm'))
9 ,to_number(to_char(e.hire_date, 'rrrr')))
10 model ignore nav
11 PARTITION BY(department_id)
12 dimension BY(MONTH, YEAR)
13 measures(count_)(
14 count_ [1, 1990] = count_ [2, 1996] + count_ [8, 1997]
15 );
DEPARTMENT_ID MONTH YEAR COUNT_
100 8 1994 2
30 12 1997 1
100 3 1998 1
30 7 1997 1
5 1999 1
30 12 1994 1
30 11 1998 1
30 5 1995 1
100 9 1997 2
100 12 1999 1
30 8 1999 1
1 1990 0
30 1 1990 0
100 1 1990 0
90 9 1989 1
20 8 1997 1
70 6 1994 1
93 rows selected
SQL> -
Is it possible to upload non-numeric data into Planning from ODI?
Dear All,
I have problem to upload non-numeric data into planning?
Regards,
ThomasI am not sure what that has to do with non-numeric data and planning.
If you want to move your ODI environment then have a look at this post :- Re: move full ODI environment to another Machine...
Cheers
John
http://john-goodwin.blogspot.com/
Maybe you are looking for
-
On certain websites, i get the message "Java is required to view this image/page", instead of seeing the image or page. What is the problem, and how to i fix this? It suddenly happend yesterday, i love my Firefox so much better than Safari on my MAC
-
I have CS 6 which requests I sign in to access my serial numbers, which I have already, and it fails to connect so that I cannot use the programs. How do I get past this, is there a direct line to customer support in the UK? Thanks
-
Enterprise Wiki copy bug in "Pages" edit mode
All functions cease working when I am in the "Pages" edit mode. My Steps: 1. In Enterprise Wiki (SharePoint 2013) I click on "edit this page" 2. Click on View Properties 3. While in the View mode click on Edit 4. Click in the Contact field to copy co
-
"Do you want to save changes" always poping when closing home made PDF
Hi, I create a pdf by myself in one of my application (only external lib used is zlib for deflate streams) I tried to follow the PDF references. It's a simple PDF file with a few pages, some text & lines to underline (deflated or not same problem), a
-
Java Error when using SAP's Webgui on JRE 1.5.0_07
Hi all, when I try to download a report from an SAP instance via webgui, I get the following in the Java Control Panel. I have tried several different version of JRE, SDK, JDK etc... and they all return the same problem. SAP haven't been much use so