ROUND and TRUNC function
Guys,
About the query below, how is the output and how SQL treats that?
SELECT TRUNC(ROUND(156,00,-1),-1)
FROM DUAL
Thank you!
Don't be afraid of breaking Oracle by actually trying things.
Break it into pieces and look at each piece one at a time.
Remove the TRUNC operation and see what you get. Do you understand why you get that result? If not, post it and we can help explain it.
But you need to make the effort yourself.
See the SQL Language doc. It has an example just like yours.
http://docs.oracle.com/cd/B28359_01/server.111/b28286/functions142.htm
>
ROUND returns n rounded to integer places to the right of the decimal point. If you omit integer, then n is rounded to zero places. If integer is negative, then n is rounded off to the left of the decimal point.
The following example rounds a number one digit to the left of the decimal point:
SELECT ROUND(15.193,-1) "Round" FROM DUAL; Round ---------- 20
>
Which means your number, 156,00, will get rounded one digit to the left of the decimal point. So 156 gets rounded to 160.00 since the '6' is equal to or larger than '5' it gets rounded up.
That leaves a result of 160.00. The TRUNC operation does something similar excepts instead of rounding one place left it truncates. But since one place left already has a '0' there is nothing for TRUNC to do so you still have 160.00
Similar Messages
-
What is the difference between ROUND and TRUNC functions in SQL
The docs are your friends.
Round Number
Round Date
Trun Number
Trunc Date
Cheers
Sarma. -
Can i get the examples for Round and Trunc with dates?
Hi Rahul,
Check out this workout by Tom Kyte on TRUNC and ROUND -
http://www.oracle.com/technetwork/issue-archive/2012/12-sep/o52sql-1735910.html
Dont skip even a single line of it. Really useful.
My little workout :
Ranit>> select
2 round(123.444) r1,
3 round(123.999) r2,
4 trunc(123.444) t1,
5 trunc(123.999) t2
6 from
7 dual;
R1 R2 T1 T2
123 124 123 123
Ranit>> select
2 round(123.444,2) r1,
3 round(123.999,2) r2,
4 trunc(123.444,2) t1,
5 trunc(123.999,2) t2
6 from dual;
R1 R2 T1 T2
123.44 124 123.44 123.99
Ranit>> select
2 round(123.1234,2) r1, -- "Rounds upto 2 Decimal places"
3 round(123.1266,2) r2, -- "Rounds upto 2 Decimal places"
4 trunc(123.1234,2) t1, -- "Keeps only 2 decimal places and Truncates the rest"
5 trunc(123.1266,2) t2 -- "Keeps only 2 decimal places and Truncates the rest"
6 from
7 dual;
R1 R2 T1 T2
123.12 123.13 123.12 123.12
--"Note the difference in R2 andT2 values : In R2 there's a data round-off done but in T2 it is simple cut-off of extra decimal part"HTH
Edited by: ranit B on Jan 26, 2013 7:24 PM -
Sql query usig round and decode together
can i get one sql quer for returning whole number using round and decode function
eg:
the value 47
if value=47
then
the query should return 50
if the value =44
then
the quer should return 40
pls give me sql query for above example using round and decode function
Edited by: user11368167 on Jul 9, 2009 3:35 AMA wild guess. If you want the ROUND Function to work only when your column value is 44 or 47 then you could use something like:
SQL> WITH test_tab AS
2 (SELECT 44 col_1
3 FROM DUAL
4 UNION ALL
5 SELECT 15 col_1
6 FROM DUAL
7 UNION ALL
8 SELECT 47 col_1
9 FROM DUAL
10 UNION ALL
11 SELECT 45 col_1
12 FROM DUAL)
13 -- end of test data
14 SELECT col_1,
15 DECODE (col_1,
16 44, ROUND (col_1, -1),
17 47, ROUND (col_1, -1),
18 col_1
19 ) rounded_value
20 FROM test_tab
21 /
COL_1 ROUNDED_VALUE
44 40
15 15
47 50
45 45
4 rows selected.
SQL> CASE Statement can be used as well instead of DECODE.
Good Luck,
Regards,
Jo -
Another thread from today made me think of the basics of TRUNC function used for DATEs. I am confused about what it acutally does.
This is what Oracle Documenations says about TRUNC function without format (like 'DD-MON-YY')
"If you omit fmt, then date is truncated to the nearest day" (Oracle 10Gr2 SQL reference, B14200-02)
SQL> alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS';
Session altered.
Query 1.
SQL> SELECT SYSDATE FROM DUAL;
SYSDATE
06-DEC-2007 14:22:01
Query 2.
SQL> SELECT TRUNC(SYSDATE) FROM DUAL;
TRUNC(SYSDATE)
06-DEC-2007 00:00:00I have three questions
1)Since it 2:22 pm , shouldn't the result of TRUNC(SYSDATE) ie Query 2. be 7-Dec-2007 ?
2) What difference does TRUNC function make in the code apart from setting the time to 00:00:00?
3) Is it safer to add TRUNC for DATEs in the code?
SQL> select sysdate-1 from dual;
SYSDATE-1
05-DEC-2007 14:27:51
SQL> select trunc(sysdate) - 1 from dual;
TRUNC(SYSDATE)-1
05-DEC-2007 00:00:00Added third question
Message was edited by:
user609308it's not a function that rounds up date's it purely truncates to the granularity that you want.
So TRUNC(sysdate) still returns a date datatype (which still contains a date and time portion) but the time portion is truncated i.e. cleared down to it's lowest limit.
Likewise if you TRUNC(sysdate,'YYYY') then it will truncate to the year and take months, days, hours, mins and secs down to their lowest limit hence giving you 1st January of that year with 00:00:00 as the time.
It's very simple really. -
Case statement and Decode function both are not working in Select cursor.
I have tried both the Case statement and Decode function in Select cursor, but both the things are not working. On the other hand both the things work in just select statement.
See the first column in select (PAR_FLAG), I need to have this evaluated along with other fields. Can you please suggest some thing to make this work. And also I would like to
know the reason why decode is not working, I heard some where Case statement do not work with 8i.
Author : Amit Juneja
Date : 06/20/2011
Description:
Updates the Diamond MEMBER_MASTER table with the values from
INC.MEM_NJ_HN_MEMBER_XREF table.
declare
rec_cnt number(12) := 0;
commit_cnt number(4) := 0;
cursor select_cur is
Select DECODE(1,
(Select 1
from hsd_prov_contract R
where R.seq_prov_id = PM.seq_prov_id
and R.line_of_business = H.line_of_business
and R.PCP_FLAG = 'Y'
and R.participation_flag = 'P'
and SYSDATE between R.EFFECTIVE_DATE AND
NVL(R.TERM_DATE,
TO_DATE('31-DEC-9999', 'DD-MON-YYYY'))),
'Y',
'N') PAR_FLAG,
H.SEQ_ELIG_HIST,
H.SEQ_MEMB_ID,
H.SEQ_SUBS_ID,
H.SUBSCRIBER_ID,
H.PERSON_NUMBER,
H.EFFECTIVE_DATE,
H.TERM_DATE,
H.TERM_REASON,
H.RELATIONSHIP_CODE,
H.SEQ_GROUP_ID,
H.PLAN_CODE,
H.LINE_OF_BUSINESS,
H.RIDER_CODE_1,
H.RIDER_CODE_2,
H.RIDER_CODE_3,
H.RIDER_CODE_4,
H.RIDER_CODE_5,
H.RIDER_CODE_6,
H.RIDER_CODE_7,
H.RIDER_CODE_8,
H.MEDICARE_STATUS_FLG,
H.OTHER_STATUS_FLAG,
H.HIRE_DATE,
H.ELIG_STATUS,
H.PREM_OVERRIDE_STEP,
H.PREM_OVERRIDE_AMT,
H.PREM_OVERRIDE_CODE,
H.SEQ_PROV_ID,
H.IPA_ID,
H.PANEL_ID,
H.SEQ_PROV_2_ID,
H.SECURITY_CODE,
H.INSERT_DATETIME,
H.INSERT_USER,
H.INSERT_PROCESS,
H.UPDATE_DATETIME,
H.UPDATE_USER,
H.UPDATE_PROCESS,
H.USER_DEFINED_1,
H.SALARY,
H.PEC_END_DATE,
H.REASON_CODE,
H.PEC_WAIVED,
H.BILL_EFFECTIVE_FROM_DATE,
H.BILLED_THRU_DATE,
H.PAID_THRU_DATE,
H.SUBSC_DEPT,
H.SUBSC_LOCATION,
H.USE_EFT_FLG,
H.BENEFIT_START_DATE,
H.SEQ_ENROLLMENT_RULE,
H.MCARE_RISK_ACCRETION_DATE,
H.MCARE_RISK_DELETION_DATE,
H.MCARE_RISK_REFUSED_DATE,
H.COMMENTS,
H.USER_DEFINED_2,
H.USER_DEFINED_3,
H.RATE_TYPE,
H.PCPAA_OCCURRED,
H.PRIVACY_ON,
H.PCP_CHANGE_REASON,
H.SITE_CODE,
H.SEQ_SITE_ADDRESS_ID,
PM.seq_prov_id rendered_prov
from hsd_member_elig_history H,
INC.PCP_REASSIGN_RPRT_DATA P,
hsd_prov_master PM
where P.subscriber_id = H.subscriber_id
and P.rendered_pcp = PM.provider_ID
and H.elig_status = 'Y'
and (H.term_date is NULL or H.term_date >= last_day(sysdate))
order by H.Seq_memb_id;
begin
for C in select_cur loop
rec_cnt := rec_cnt + 1;
update hsd_member_elig_history
set term_date = TRUNC(SYSDATE - 1),
term_reason = 'PCPTR',
update_datetime = SYSDATE,
update_user = USER,
update_process = 'TD33615'
where seq_elig_hist = C.seq_elig_hist
and seq_memb_id = C.seq_memb_id;
INSERT INTO HSD_MEMBER_ELIG_HISTORY
(SEQ_ELIG_HIST,
SEQ_MEMB_ID,
SEQ_SUBS_ID,
SUBSCRIBER_ID,
PERSON_NUMBER,
EFFECTIVE_DATE,
TERM_DATE,
TERM_REASON,
RELATIONSHIP_CODE,
SEQ_GROUP_ID,
PLAN_CODE,
LINE_OF_BUSINESS,
RIDER_CODE_1,
RIDER_CODE_2,
RIDER_CODE_3,
RIDER_CODE_4,
RIDER_CODE_5,
RIDER_CODE_6,
RIDER_CODE_7,
RIDER_CODE_8,
MEDICARE_STATUS_FLG,
OTHER_STATUS_FLAG,
HIRE_DATE,
ELIG_STATUS,
PREM_OVERRIDE_STEP,
PREM_OVERRIDE_AMT,
PREM_OVERRIDE_CODE,
SEQ_PROV_ID,
IPA_ID,
PANEL_ID,
SEQ_PROV_2_ID,
SECURITY_CODE,
INSERT_DATETIME,
INSERT_USER,
INSERT_PROCESS,
UPDATE_DATETIME,
UPDATE_USER,
UPDATE_PROCESS,
USER_DEFINED_1,
SALARY,
PEC_END_DATE,
REASON_CODE,
PEC_WAIVED,
BILL_EFFECTIVE_FROM_DATE,
BILLED_THRU_DATE,
PAID_THRU_DATE,
SUBSC_DEPT,
SUBSC_LOCATION,
USE_EFT_FLG,
BENEFIT_START_DATE,
SEQ_ENROLLMENT_RULE,
MCARE_RISK_ACCRETION_DATE,
MCARE_RISK_DELETION_DATE,
MCARE_RISK_REFUSED_DATE,
COMMENTS,
USER_DEFINED_2,
USER_DEFINED_3,
RATE_TYPE,
PCPAA_OCCURRED,
PRIVACY_ON,
PCP_CHANGE_REASON,
SITE_CODE,
SEQ_SITE_ADDRESS_ID)
values
(hsd_seq_elig_hist.nextval,
C.SEQ_MEMB_ID,
C.SEQ_SUBS_ID,
C.SUBSCRIBER_ID,
C.PERSON_NUMBER,
trunc(SYSDATE),
C.TERM_DATE,
C.TERM_REASON,
C.RELATIONSHIP_CODE,
C.SEQ_GROUP_ID,
C.PLAN_CODE,
C.LINE_OF_BUSINESS,
C.RIDER_CODE_1,
C.RIDER_CODE_2,
C.RIDER_CODE_3,
C.RIDER_CODE_4,
C.RIDER_CODE_5,
C.RIDER_CODE_6,
C.RIDER_CODE_7,
C.RIDER_CODE_8,
C.MEDICARE_STATUS_FLG,
C.OTHER_STATUS_FLAG,
C.HIRE_DATE,
C.ELIG_STATUS,
C.PREM_OVERRIDE_STEP,
C.PREM_OVERRIDE_AMT,
C.PREM_OVERRIDE_CODE,
C.SEQ_PROV_ID,
C.IPA_ID,
C.PANEL_ID,
C.SEQ_PROV_2_ID,
C.SECURITY_CODE,
SYSDATE,
USER,
'TD33615',
SYSDATE,
USER,
'TD33615',
C.USER_DEFINED_1,
C.SALARY,
C.PEC_END_DATE,
C.REASON_CODE,
C.PEC_WAIVED,
C.BILL_EFFECTIVE_FROM_DATE,
C.BILLED_THRU_DATE,
C.PAID_THRU_DATE,
C.SUBSC_DEPT,
C.SUBSC_LOCATION,
C.USE_EFT_FLG,
C.BENEFIT_START_DATE,
C.SEQ_ENROLLMENT_RULE,
C.MCARE_RISK_ACCRETION_DATE,
C.MCARE_RISK_DELETION_DATE,
C.MCARE_RISK_REFUSED_DATE,
C.COMMENTS,
C.USER_DEFINED_2,
C.USER_DEFINED_3,
C.RATE_TYPE,
C.PCPAA_OCCURRED,
C.PRIVACY_ON,
C.PCP_CHANGE_REASON,
C.SITE_CODE,
C.SEQ_SITE_ADDRESS_ID);
commit_cnt := commit_cnt + 1;
if (commit_cnt = 1000) then
dbms_output.put_line('Committed updates for 1000 records.');
commit;
commit_cnt := 0;
end if;
end loop;
commit;
dbms_output.put_line('Total number of MEMBER_ELIG_HISTROY records inserted : ' ||
rec_cnt);
exception
when others then
raise_application_error(-20001,
'An error was encountered - ' || sqlcode ||
' -error- ' || sqlerrm);
end;user10305724 wrote:
I have tried both the Case statement and Decode function in Select cursor, but both the things are not working. Please define what you mean by not working even if your computer screen is near the internet we can't see it.
You should also look at the FAQ about how to ask a question
SQL and PL/SQL FAQ
Particularly *9) Formatting with {noformat}{noformat} Tags* and posting your version.
know the reason why decode is not working, I heard some where Case statement do not work with 8i.
Does this mean you are using 8i? Then scalar sub queries - selects within the select list, are not supported, along with CASE in PL/SQL.
Select DECODE(1,
* (Select 1
from hsd_prov_contract R
where R.seq_prov_id = PM.seq_prov_id
and R.line_of_business = H.line_of_business
and R.PCP_FLAG = 'Y'
and R.participation_flag = 'P'
and SYSDATE between R.EFFECTIVE_DATE AND
NVL(R.TERM_DATE,
TO_DATE('31-DEC-9999', 'DD-MON-YYYY')))*,
'Y',
'N') PAR_FLAG,
>
exception
when others then
raise_application_error(-20001,
'An error was encountered - ' || sqlcode ||
' -error- ' || sqlerrm);
http://tkyte.blogspot.com/2008/01/why-do-people-do-this.html -
How do i cancel after the circles of hell go round and round?
I have been in the circles of hell trying to cancel my subscription which my credit card, i was surprised to learn, had been charged for- only to find it is already cancelled! See below
Adobe ExportPDF, Annual
Cancelled: Effective February 2, 2016
Restart
But I have just been billed for it anyway. And probably be billed for it in another year - 2016. And then it will probably "automatically" (see fine print) restart.and so on till i am very very old. interesting to see on other posts that cancelling the credit card does not help which seems odd but then again after two hours of wandering round and round the site (love the hilarity of the non-functioning chat icon - much hilarity every Christmas in the accounting department.) I'm not surprised. It is clear that adobe has one of the most difficult "unsubscribes" online. Despite the professionals hunting them down and killing them, there are still websites devoted to the topic of why can't I unsubscribe and why is this so hard and surely this is illegal. Adobe clearly makes most of its money out of the unsubscribe because the two products I bought didn't work anyway. Fair enough, should have known, but remind me to employ a lawyer in future before even opening an adobe document.Hi there,
Sorry for the frustrating experience, looking at the account I could see the billing has been stopped for the subscription and you will continue to have the access to software till 2016.
Please update this thread if you would like to cancel the subscription and get refund.
^Ani -
ORA-00932 while using nvl with trunc function
What happens when trunc is executed on null?
I am executing the following query:
"select nvl(trunc(null),sysdate) from dual"
and this throws "ORA-00932: inconsistent datatypes: expected NUMBER got DATE, error at Line:1 Column:23".
Whereas "select nvl(null,sysdate) from dual" returns sysdate correctly.
Also "select trunc(null) from dual" returns null only. So when the returned null is passed through nvl why am I getting exception?
This is happening in ver 9.2.0.5.0 and 10.2.0.2.0
There is another observation, which is an issue that we have found in our code, and while trying to fix that we saw the earlier observation.
SELECT * FROM orgs, dual where
trunc(SYSDATE) between trunc(orgs.effective_start_date) and nvl(trunc(orgs.effective_end_date),trunc(sysdate))
Here effective start date and effective end date for orgs are null for all records.
When we run this query on ver 9.2.0.5.0, this runs without any exception. But when we run this query on ver 10.2.0.2.0, we get the same exception, "ORA-00932: inconsistent datatypes: expected NUMBER got DATE, error at Line:2 Column:95".
The join with dual is fake, in actual scenario we have join with other tables, but since we are able to replicate with dual, removed all other details to keep this simple.
Now if we remove the join with dual, the query works fine in both the env.
SELECT * FROM orgs where
trunc(SYSDATE) between trunc(orgs.effective_start_date) and nvl(trunc(orgs.effective_end_date),trunc(sysdate))What happens when trunc is executed on null?
I am executing the following query:
"select nvl(trunc(null),sysdate) from dual"
and this throws "ORA-00932: inconsistent datatypes:
expected NUMBER got DATE, error at Line:1
Column:23".
Whereas "select nvl(null,sysdate) from dual" returns
sysdate correctly.
Also "select trunc(null) from dual" returns null
only. So when the returned null is passed through nvl
why am I getting exception?
This is happening in ver 9.2.0.5.0 and 10.2.0.2.0The first parameter to NVL is determining the expected datatype of the returned column, with the trunc function defaulting that to NUMBER because it's parameter is NULL. The second parameter to NVL needs to match that datatype which it doesn't because it is a date.
SQL> select nvl(trunc(sysdate), sysdate) as mydate from dual;
MYDATE
26/05/2006 00:00:00
SQL> select nvl(trunc(null), sysdate) as mydate from dual;
select nvl(trunc(null), sysdate) as mydate from dual
ERROR at line 1:
ORA-00932: inconsistent datatypes: expected NUMBER got DATE
SQL> select nvl(trunc(123), sysdate) as mydate from dual;
select nvl(trunc(123), sysdate) as mydate from dual
ERROR at line 1:
ORA-00932: inconsistent datatypes: expected NUMBER got DATE
SQL> -
NVL Function and Truncate Function in Template Builder
Hi Guys,
How would I use NVL function and Truncate function in the Word Template Builder.
These functions do not work in the Query Builder when i use SQL Query as the Dataset while creating a report.
I could not find examples in the Publisher Guide either.
Thanks
rkingmduHi
How can you not use the functions in your query? Does the builder return an error? ow about just pasting your query into the report definition does the nvl/trunc work then ?
Regards
Tim
http://blogs.oracle.com/xmlpublisher -
How to use the palette or drag and drop functions in netbean?
Is there anyone who can help me out on using drag and drop function in netbean to design GUI inteface..??
Is palette is the tool that can be used to drag and drop.??
thank you in advance.I actually really like the GUI builder in netbeans. I used to be a big eclipse user so I am very familiar with coding GUIs by hand, and most of what I do involves GUI's or at least swing.
At first I hated netbeans, I hated that I couldn't edit the code most. Then I decided to take a deep breath and really examine the issue. What I discovered is that most of the edits I wanted to make but couldn't really weren't the right way to be doing it in the first place, for the rest the code is actually really easy to change you just have to know how.
Now my palette is huge, probably about 250 objects in it organized into sections that work for me. Basically if I want a object to do something that is not already in the palette I simply write a new object and add it to the palette. I started small like with rounded buttons/progress bars, and as I got comfortable I now have some fairly advanced objects like grids, isometric grids, alpha composits, an animated hourglass countdown timer, and an animated "loading/activity" indicator that is not tied to a progress indicator.
The main reason I stuck with the netbeans drag and drop GUI builder is it's layout manager is really a very nice layout manager, you couldn't pay me enough to go back to eclipse or codeing GUIs by hand, as I can now do in one day what used to take me several weeks.
So what I am saying is stick with netbeans and the drag and drop, it sucks at first, but once you get to a point where you are comfortable with it and adding to the palette it will become a great tool.
JSG -
CRM 4.0 and Partner Functions?
As I understand it, they believe that there is a limitation on the number of partner functions that can be replicated
between CRM 4.0 and ERP?
And the limitation is a total of 999?
But what if more than 999 are needed?
I guess that these are created as follows:
Transaction SPRO
u2013 CRM
u2013 Basic Functions
u2013 Partner Processing
u2013 Data Transfer
u2013 Distribution of Partner Functions from CRM into R/3
and the table involved is CRMC_PARTNER_2R3
Is there a workaround?
Is there a greater number of partner functions allowed in newer CRM releases?The limitation is the standard system design in ERP, not CRM.
There is a limit of 999 entries due to a field length of 3 characters. Please see table KNVP - the field PARZA is the Partner Counter, and you can see in the table that it is defined as only 3 characters, hence the 999 limitation.
Here are 2 options to consider to demonstrate that there are possible options:
- A ship-to partner does not need to be assigned to a sold-to in order to be used on a sales order. As long as the ship-to has been
set up (using transaction XD01 and account group 0002) you can use any ship-to in an order.Break up the sold-to by regions or some other means so that you can accommodate all of the ship-to's.
- You could possibly make a work round by changing the domain PARZA to 4 digits , but this would be a work round and would require a full investigation on the feasibility of this change. Unfortunately this would have to be on a Consultancy basis, see SAP Note 83020. Also SAP Note 170183 would apply. -
Are Truncate and Trunc SQL ISO ANSI compliance ?
Somebody has idea of
which of the statements TRUNCATE and TRUNC are SQL ISO ANSI compliance ?
is Truncate a function or a statement ?
Thanks
Nelsonperhaps this answer has the potential to add some confusing, but maybe it shows a little problem with ANSI compliance:
For Oracle a TRUNCATE TABLE is a DDL operation that includes an implicit commit preventing a rollback:
-- Oracle 11.2.0.1
SQL> create table t(a number);
Tabelle wurde erstellt.
SQL> insert into t(a) values(1);
1 Zeile wurde erstellt.
SQL> commit;
Transaktion mit COMMIT abgeschlossen.
SQL> truncate table t;
Tabelle mit TRUNCATE geleert.
SQL> rollback;
Transaktion mit ROLLBACK rückgängig gemacht.
SQL> select * from t;
Es wurden keine Zeilen ausgewählt
Sorry about the german sqlplus feedback - but I think the result is clear: the table is empty after the truncate and the data is gone.
But for MS SQL Server a TRUNCATE can be rolled back:
-- SQL Server 2008
drop table t;
create table t(a int);
insert into t(a) values(1);
begin transaction
truncate table t;
rollback;
select * from t;
a
1
Microsoft also defines TRUNCATE as DDL - http://msdn.microsoft.com/en-us/library/ff848799.aspx - but the behavior is quite different. So ANSI compliance does not mean that much (I have absolutly no idea which of the two solutions is more ANSI compliant in this case).
Regards
Martin -
Why do I have a black screen with the icon spinning round and won't open?
why do I have a black screen with the icon spinning round and won't open my photos?
Because there is a problem. Want to try fix it?
Option 1
Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
If that fails:
Option 2
Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
Regards
TD -
Subversion and Trunc/Branch merging
Hi All,
We have been trialing data modeler for a single project, but we are so impressed, we want to use it across the IT estate.
Therefore we need to propose a process that is robust and allows us to co-ordintate teams and versions of the databases.
We have come up with the following - I am hoping for advice on whether there are easier methods to achieve the below.
When moving from branch to trunc, I need the following process (which I suspent most people need in some guise or another).
1. Compare branch changes to trunc.
2. Identify all changes between trunc and branch (and document them into a release document)
3. Resolve any off-project but neccessary trunc changes into branch and re-integrate into development cycle (other project changes, live fixes etc....).
4. Generate DDL to move from trunc to branch (ie database upgrade script to branch level).
5. Merge back into trunc and report merge details (so we can match them up to 2.).
6. Generate full DDL for latest trunc.
Data modeler seems to allow me to do most of this, but I am wondering if there is a better way for some of it:
1. Using Versioning "Merge Design" I can compare and resolve conflict.
2. Is there an wasy way to report into a document, the differences between 2 models?
3. I have to open up branch and import changes from trunc, before re-opening trunc and importing from branch - even though they are the same changes.
4. Checkout both models and do "model compare". Is there a way without having to checkout both models? - ie within subversion repo
5. Ok, easy enough - open Trunc and merge back in.
6. Generate fresh baseline DDL from trunc.
Outputs:
Branch=Trunc
DDL to move from Old Trunc to New Trunc
DDL to build new Trunc from scratch
Report on difference between Trunc versions.Hi,
I assume you are using DM 3.3.
1. Compare branch changes to trunc.
2. Identify all changes between trunc and branch (and document them into a release document)You can use SVN repository tools to get reports about changes. Otherwise you can get changes comparing two relational models (part of two designs) - you need to check out designs at point(revisions) you
want to compare. Compare dialog has "Tree view" and "Tabular view" - you can generate report about all changes in "Tabular view"
3. Resolve any off-project but neccessary trunc changes into branch and re-integrate into development cycle (other project changes, live fixes etc....).If you use DM 3.3 as part of SQL Developer you can use "View>Files" to get window with directories structure and versioning functionality is available for versioned files. This functionality is limitted to less functions in Standalone version of DM.
Or you can use third party tool for that - DM 3.3 comes with 1.6 SVN client so you should take care to use tool for 1.6 SVN.
4. Generate DDL to move from trunc to branch (ie database upgrade script to branch level).Using compare of two models at related repository revisions.
5. Merge back into trunc and report merge details (so we can match them up to 2.).
3. I have to open up branch and import changes from trunc, before re-opening trunc and importing from branch - even though they are the same changes.
5. Ok, easy enough - open Trunc and merge back in.1) You need to merge trunk into branch first in order to see that design in branch has no problems and then
2) use "Merge reintegrate" to get changes (in branch only) back to trunk - after successful merge reintegrate you should not use branch any more, another branch can be created if you want to split work again
Of course you can choose to not follow that path and do merging of different objects or revisions.
4. Checkout both models and do "model compare". Is there a way without having to checkout both models? - ie within subversion repoNo
Philip -
GUI_DOWNLOAD and UPLOAD Function Modules?
Hi All,
What exactly done by GUI_DOWNLOAD and UPLOAD Function Modules?
Akshitha.What you exactly want know?
Here is the Sap documentation for both FM:
FU GUI_UPLOAD
Short Text
Upload for Data Provider
Functionality
The module loads a file from the PC to the server. Data can be transferred binarily or as text. Numbers and date fields can be interpreted according to the user settings.
Example
Binary upload: No conversion or interpretation
begin of itab,
raw(255) type x,
end of itab occurs 0.
CALL FUNCTION 'GUI_UPLOAD'
exporting
filetype = 'BIN'
filename = 'C:\DOWNLOAD.BIN'
tables
data_tab = itab.
Text upload
begin of itab,
text(255) type c,
end of itab occurs 0.
CALL FUNCTION 'GUI_UPLOAD'
exporting
filetype = 'ASC'
filename = 'C:\DOWNLOAD.TXT'
tables
data_tab = itab.
Parameters
FILENAME
FILETYPE
HAS_FIELD_SEPARATOR
HEADER_LENGTH
READ_BY_LINE
DAT_MODE
CODEPAGE
IGNORE_CERR
REPLACEMENT
CHECK_BOM
VIRUS_SCAN_PROFILE
NO_AUTH_CHECK
FILELENGTH
HEADER
DATA_TAB
Exceptions
FILE_OPEN_ERROR
FILE_READ_ERROR
NO_BATCH
GUI_REFUSE_FILETRANSFER
INVALID_TYPE
NO_AUTHORITY
UNKNOWN_ERROR
BAD_DATA_FORMAT
HEADER_NOT_ALLOWED
SEPARATOR_NOT_ALLOWED
HEADER_TOO_LONG
UNKNOWN_DP_ERROR
ACCESS_DENIED
DP_OUT_OF_MEMORY
DISK_FULL
DP_TIMEOUT
Function Group
SFES
FU GUI_DOWNLOAD
Short Text
Download an Internal Table to the PC
Functionality
Data transfer of an internal table form the server to a file on the PC. The Gui_Download module replaces the obsolete modules Ws_Download and Download. The file dialog of the download module is available in the class Cl_Gui_Frontend_Services.
Further information
TYPE-POOLS: ABAP.
Binary download table
DATA: BEGIN OF line_bin,
data(1024) TYPE X,
END OF line_bin.
DATA: data_tab_bin LIKE STANDARD TABLE OF line_bin.
Ascii download table
DATA: BEGIN OF line_asc,
text(1024) TYPE C,
END OF line_asc.
DATA: data_tab_asc LIKE STANDARD TABLE OF line_asc.
DAT download table
DATA: BEGIN OF line_dat,
Packed TYPE P,
Text(10) TYPE C,
Number TYPE I,
Date TYPE D,
Time TYPE T,
Float TYPE F,
Hex(3) TYPE X,
String TYPE String,
END OF line_dat.
DATA: data_tab_dat LIKE STANDARD TABLE OF line_dat.
Get filename
DATA: fullpath TYPE String,
filename TYPE String,
path TYPE String,
user_action TYPE I,
encoding TYPE ABAP_ENCODING.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
WINDOW_TITLE = 'Gui_Download Demo'
WITH_ENCODING = 'X'
INITIAL_DIRECTORY = 'C:\'
CHANGING
FILENAME = filename
PATH = path
FULLPATH = fullpath
USER_ACTION = user_action
FILE_ENCODING = encoding
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
IF user_action <> CL_GUI_FRONTEND_SERVICES=>ACTION_OK.
EXIT.
ENDIF.
Download variables
DATA: length TYPE I.
Binary download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = fullpath
FILETYPE = 'BIN'
IMPORTING
FILELENGTH = length
TABLES
DATA_TAB = data_tab_bin
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
Ascii download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = fullpath
FILETYPE = 'ASC'
IMPORTING
FILELENGTH = length
TABLES
DATA_TAB = data_tab_asc
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
DAT download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = fullpath
FILETYPE = 'DAT'
IMPORTING
FILELENGTH = length
TABLES
DATA_TAB = data_tab_dat
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
Parameters
BIN_FILESIZE
FILENAME
FILETYPE
APPEND
WRITE_FIELD_SEPARATOR
HEADER
TRUNC_TRAILING_BLANKS
WRITE_LF
COL_SELECT
COL_SELECT_MASK
DAT_MODE
CONFIRM_OVERWRITE
NO_AUTH_CHECK
CODEPAGE
IGNORE_CERR
REPLACEMENT
WRITE_BOM
TRUNC_TRAILING_BLANKS_EOL
WK1_N_FORMAT
WK1_N_SIZE
WK1_T_FORMAT
WK1_T_SIZE
WRITE_EOL
FILELENGTH
DATA_TAB
FIELDNAMES
Exceptions
FILE_WRITE_ERROR
NO_BATCH
GUI_REFUSE_FILETRANSFER
INVALID_TYPE
NO_AUTHORITY
UNKNOWN_ERROR
HEADER_NOT_ALLOWED
SEPARATOR_NOT_ALLOWED
FILESIZE_NOT_ALLOWED
HEADER_TOO_LONG
DP_ERROR_CREATE
DP_ERROR_SEND
DP_ERROR_WRITE
UNKNOWN_DP_ERROR
ACCESS_DENIED
DP_OUT_OF_MEMORY
DISK_FULL
DP_TIMEOUT
FILE_NOT_FOUND
DATAPROVIDER_EXCEPTION
CONTROL_FLUSH_ERROR
Function Group
SFES
Maybe you are looking for
-
Facebook -Push & email Notifications not working since u/g to v5.1
Is anyone else experiecning issues with setting up new Push notification for facebook on their iPhone? I have iPhone5 running iOS 6.0.1 and upgraded to Facebook Version 5.1. (I also have the older version of Facebook within iTunes on my mac and if I
-
How can I stream from iTunes 11.3 to my AppleTV?
I had enabled Home Sharing on my iTunes 11.3 from Windows XP and also enabled the Home Sharing in the AppleTV 3rd-gen. But I still cannot see the AppleTV in the list of available streaming devices from iTunes (stream icon at the right of the volume b
-
Wifi bar issue with brand new iPhone 4S
My wifi bar was greyed out, and I just had to get a new iPhone 4s to solve the problem. That was today, and the issue has already returned after I updated from 7.0.1 to 7.1. Help?
-
When I copy text where on the desk top can I put it?
I'm new to Mac and I copied a newspaper article out, for my genealogy, and didn't want to paste it to Word because it saves it as a pdf., I want to save it as a jpg. for my family tree. Where or how can I paste the article and then save it to my des
-
XML Parse issues when using Network Data Model LOD with Springframework 3
Hello, I am having issues with using using NDM in conjuction with Spring 3. The problem is that there is a dependency on the ConfigManager class in that it has to use Oracle's xml parser from xmlparserv2.jar, and this parser seems to have a history o