About using TRIM function...
//I'm posting this after whole search of past discussion as everybody wants to do so. :-)
Hi,
I want to trim out white spaces from colums in my table when select executes.
I've read about TRIM function, but it does not as documented I think.
See below my pseudo-code from trimming.
SELECT trim (' ' from col1) | | col2, FROM TH_ABLICEN WHERE..blah..blah..This SQL query return me "ORA-00907: missing right parenthesis".
I don't know how can this returns...
TRIM function works only when its parameter is a constant and fails always when columns were injected as a parameter.
This situation is very obscure to me and make me wondering ORACLE's intention for this kind of inconvenience.
And I've tried replace (col1, ' ', '') only to fail.
So my question is...
1. How can use trim function?
2. What is the ordinary method being used by popular demand to trim out white spaces from a column?
Thanks in advance
Regards,
Ryan
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Adinath Kamode ([email protected]):
Hello,
Your query is correct. I tried it with 8.1.6 sql version. I modified it as follows.
select trim(' ' FROM ENAME)| |JOB FROM EMP;
about syntax you can specify column name in trim.
hope reply from you.
<HR></BLOCKQUOTE>
As mentioned in my first posting, it returns "ORA-00907: missing right parenthesis" error.
Anyway thanks for your concern.
Regards,
Ryan
null
Similar Messages
-
Error when trying to use trim function
when i try to use trim function on a column it gives me following error for the below query
select trim(first_name) name from table1@pa1;
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
DSNT408I SQLCODE = -440, ERROR: NO FUNCTION BY THE NAME TRIM HAVING COMPATIBLE ARGUMENTS WAS FOUND IN THE CURRENT PATH DSNT418I SQLSTATE = 42884 SQLSTATE RETURN CODE DSNT415I SQLERRP = DSNXORFN SQL PROCEDURE DETECTING ERROR DSNT416I SQLERRD = -100 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION DSNT416I SQLERRD = X'FFFFFF
any idea gurus ???ThanksThis might work:
select trim(first_name) name from
(select first_name from table1@pa1);The problem is that pa1 is a non-Oracle database and does not have a trim function. It may have another function that does the same thing but it's not called TRIM. -
Using TRIM function in select statement
Hi All,
I'm using the TRIM function in my select statement to eliminate the white spaces.
But while using in select the TRIM function is not working in SQL*PLUS client(The query returns the white spaces also)
Kindly provide some pointers regarding the issue.........
I want to get only the data without the spaces in select statement
Regards,
MohanHi, Mohan,
SQL*Plus always pads columns to make them line up nicely.
If you have a column declared as VARCHAR2 (20), then SQL*Plus will normally display 20 characters for that column, even in the maximum actual length is, say, 5 (or even if the column always happens to be NULL).
If you want the output to include only the actual data, without the padding that SQL*Plus adds, then concatenate all the columns into one big string column.
People often do something like the following to generate a CSV file, with no exta spaces:
SELECT TO_CHAR (empno)
|| ',' || ename
|| ',' || job
|| ',' || TO_CHAR (deptno)
|| ',' || TO_CHAR (hiredate, 'DD-Mon-YYYY') AS all_data
FROM scott.emp; -
Use Trim Function in this instance?
Oracle 10.2g
I have the following code (Thanks to michaels 2):
SQL> with t as (
select to_date('11/14/2003 7:39:00 PM','MM/DD/RRRR hh:mi:ss pm') time, 11122 home_team_id,null away_team_id,null home_team_name, 'parks' away_team_name,'Steve' offensive_player_moniker, 'Smith' offensive_player_last_name from dual union all
select to_date('11/14/2003 7:32:00 PM','MM/DD/RRRR hh:mi:ss pm'), null, 24555, null, 'bombers', 'Chris', 'Carter' from dual union all
select to_date('12/14/2008 1:35:00 PM','MM/DD/RRRR hh:mi:ss pm'), null, 33211, null, 'carts', 'Marty', 'Booker' from dual union all
select to_date('12/14/2008 1:30:00 PM','MM/DD/RRRR hh:mi:ss pm'), 15555, null, null, 'sharks', 'Bob', 'Sanders' from dual union all
select to_date('12/14/2008 1:38:00 PM','MM/DD/RRRR hh:mi:ss pm'), 15555, null, null, 'sharks', 'Marvin','Harrison' from dual
select away_team_name || ': ' || xmlagg(xmlelement(e, offensive_player_moniker || ' ' || offensive_player_last_name || ' (' || to_char(time,'hh:mi') || '), ')).extract('//text()') x from t
group by away_team_name
X
bombers: Chris Carter (07:32),
carts: Marty Booker (01:35),
parks: Steve Smith (07:39),
sharks: Bob Sanders (01:30), Marvin Harrison (01:38),
Desired output:
bombers: Chris Carter (07:32)
carts: Marty Booker (01:35)
parks: Steve Smith (07:39)
sharks: Bob Sanders (01:30), Marvin Harrison (01:38)How can i go about deleting the extra coma at the end when unnecessary. I' guessing the trim function could do it with an if-else clause, though i'm not sure what would go in the if-else clauseSince there's an additional blank as well you need to trim it as well
SQL> with t as (
select to_date('11/14/2003 7:39:00 PM','MM/DD/RRRR hh:mi:ss pm') time, 11122 home_team_id,null away_team_id,null home_team_name, 'parks' away_team_name,'Steve' offensive_player_moniker, 'Smith' offensive_player_last_name from dual union all
select to_date('11/14/2003 7:32:00 PM','MM/DD/RRRR hh:mi:ss pm'), null, 24555, null, 'bombers', 'Chris', 'Carter' from dual union all
select to_date('12/14/2008 1:35:00 PM','MM/DD/RRRR hh:mi:ss pm'), null, 33211, null, 'carts', 'Marty', 'Booker' from dual union all
select to_date('12/14/2008 1:30:00 PM','MM/DD/RRRR hh:mi:ss pm'), 15555, null, null, 'sharks', 'Bob', 'Sanders' from dual union all
select to_date('12/14/2008 1:38:00 PM','MM/DD/RRRR hh:mi:ss pm'), 15555, null, null, 'sharks', 'Marvin','Harrison' from dual
select rtrim(away_team_name || ': ' || xmlagg(xmlelement(e, offensive_player_moniker || ' ' || offensive_player_last_name || ' (' || to_char(time,'hh:mi') || '), ')).extract('//text()'), ', ') x from t
group by away_team_name
X
bombers: Chris Carter (07:32)
carts: Marty Booker (01:35)
parks: Steve Smith (07:39)
sharks: Bob Sanders (01:30), Marvin Harrison (01:38) -
How to use RTRIM function in ABAP
Hey,
I have a question on using trim function in ABAP. According to all documents, I should be able to use rtrim as
shorttext = rtrim('abcde-xx', '-xx').
But when I do that, it gives me an error message "Comma without preceding colon (after shorttest?)"
Anyone can tell me why is this happening? how should I use this trim function? And for me to cut off variable's last few character, what else method can I use?
Thank you very much.DATA : T1 TYPE STRING VALUE 'abcde-xx',
T2 TYPE STRING VALUE '-xx'.
REPLACE T2 INTO T1 WITH SPACE.
WRITE :/, T1.
result output is : 'abcde'.
regards
Guna -
Trim function on varchar2 data
I just saw several programs, in which they have used TRIM function for a Varchar2 data type column. I thought it is not required. any thoughts?
Thanks for your time.SQL> desc test_1;
Name Null? Type
SNO NUMBER
SNAME VARCHAR2(13)
SQL> select * from test_1;
SNO SNAME
1 abc
2 xyz
3 mno
4 pqr
SQL> select sno,sname,trim(sname),length(sname) len1,length(trim(sname)) len2 from test_1;
SNO SNAME TRIM(SNAME) LEN1 LEN2
1 abc abc 3 3
2 xyz xyz 6 3
3 mno mno 11 3
4 pqr pqr 13 3
SQL> alter table test_1 modify sname char(13);
Table altered.
SQL> desc test_1;
Name Null? Type
SNO NUMBER
SNAME CHAR(13)
SQL> select sno,sname,trim(sname),length(sname) len1,length(trim(sname)) len2 from test_1;
SNO SNAME TRIM(SNAME) LEN1 LEN2
1 abc abc 13 3
2 xyz xyz 13 3
3 mno mno 13 3
4 pqr pqr 13 3
SQL> -
How do I use the TRIM function in my Query?
I have a field that has called AP.service_user_defined_1 that houses a Code the code is like Alpha Num ie "AA01" then it has about 30 to 40 whites spaces and then the description of what the code means. I need to have the description to show in my report I don't necessarily need the code but I do need the description I tried putting the TRIM Function in as below and it will not work what do I need to do to correct this?? I need help ASAP this is due today! Thanks for any help!
SELECT DISTINCT
A1.AUTH_NUMBER,
PM.LAST_NAME,
A1.AUTH_TYPE,
A1.PLACE_OF_SERVICE,
A1.OVERALL_STATUS,
A1.CLOSED_REASON,
A1.DENIED_REASON,
Case
when A1.DENIED_REASON in ('HS001','HS002') then 'MED NECESS'
when A1.DENIED_REASON in ('HS004','HS005','HS006','HS007','HS008','HS013','HS014','HS016','HS017','HS019','HS020') then 'Admin Denial'
when A1.DENIED_REASON is NUll and ap.advisor_decision = 'AAPPR' then 'Approved'
else 'Unknown'
end DENIED,
A1.admit_primary_date,
A1.service_admit_type AS "IP ADMIT TYPE",
A1.service_user_defined_1 AS "OP Serv Type",
Trim (leading ('AA01 ',)from dual,
ap.contact_date,
AP.decision_date,
AP.ADVISOR_DECISION,
PM.PROVIDER_ID,
A1.INSERT_DATETIME,
TO_CHAR (A1.insert_datetime,'MONTH-YY')AS "Month",
A1.admit_primary_date,
A1.ACTIVE_PHYSICIAN_ADVISOR,
MV.LINE_OF_BUSINESS
FROM Windsoradm.auth_master a1
INNER JOIN Windsoradm.auth_phys_advisor ap
ON a1.auth_number=ap.auth_number
INNER JOIN windsoradm.prov_master pm
ON ap.seq_prov_id=pm.seq_prov_id
LEFT JOIN windsoradm.note_master nm
ON nm.seq_memb_id=a1.seq_memb_id
INNER JOIN windsoradm.member_mv mv
ON mv.seq_memb_id=a1.seq_memb_id
Where mv.Line_of_Business <>'SFS'
/*AND A1.PLACE_OF_SERVICE IN ('11','21','22','24')*/
/*AND a1.active_physician_advisor = 'Y'*/
/*AND (a1.closed_reason ='A06' OR a1.closed_reason is Null)*/
AND a1.insert_datetime Between To_Date ('04/01/2012', 'MM/DD/YYYY') and To_Date ('04/30/2012','MM/DD/YYYY')
ORDER BY 1I don't know how to use this within my query I put it in as you suggest and get an error: I'm new to these functions can you show me how within my query I should code it? The field Name is A1.service_user_defined_1 There are about 50 Different Codes in a Drop down list within the application that have a different Code and Different Description it appears that the Codes are all 4 character alpha numeric then about 25 to 45 spaces and then the description. Please show me in my code how to get this I wish there was a table I could link to that housed both code and description but who ever created this did not make life easy. Thanks (I also tried the TRIM but could not get it to work ) I know it is because I do not know how to put it within my code to make it work.
SELECT DISTINCT
A1.AUTH_NUMBER,
PM.LAST_NAME,
A1.AUTH_TYPE,
A1.PLACE_OF_SERVICE,
A1.OVERALL_STATUS,
A1.CLOSED_REASON,
A1.DENIED_REASON,
Case
when A1.DENIED_REASON in ('HS001','HS002') then 'MED NECESS'
when A1.DENIED_REASON in ('HS004','HS005','HS006','HS007','HS008','HS013','HS014','HS016','HS017','HS019','HS020') then 'Admin Denial'
when A1.DENIED_REASON is NUll and ap.advisor_decision = 'AAPPR' then 'Approved'
else 'Unknown'
end DENIED,
A1.admit_primary_date,
A1.service_admit_type AS "IP ADMIT TYPE",
A1.service_user_defined_1 AS "OP Serv Type",
regexp_replace('AA01 Behavioral/Mental Health Service', '^[^ ]+ +')from dual,
ap.contact_date,
AP.decision_date,
AP.ADVISOR_DECISION,
PM.PROVIDER_ID,
A1.INSERT_DATETIME,
TO_CHAR (A1.insert_datetime,'MONTH-YY')AS "Month",
A1.admit_primary_date,
A1.ACTIVE_PHYSICIAN_ADVISOR,
MV.LINE_OF_BUSINESS
FROM Windsoradm.auth_master a1
INNER JOIN Windsoradm.auth_phys_advisor ap
ON a1.auth_number=ap.auth_number
INNER JOIN windsoradm.prov_master pm
ON ap.seq_prov_id=pm.seq_prov_id
LEFT JOIN windsoradm.note_master nm
ON nm.seq_memb_id=a1.seq_memb_id
INNER JOIN windsoradm.member_mv mv
ON mv.seq_memb_id=a1.seq_memb_id
Where mv.Line_of_Business <>'SFS'
/*AND A1.PLACE_OF_SERVICE IN ('11','21','22','24')*/
/*AND a1.active_physician_advisor = 'Y'*/
/*AND (a1.closed_reason ='A06' OR a1.closed_reason is Null)*/
AND a1.insert_datetime Between To_Date ('04/01/2012', 'MM/DD/YYYY') and To_Date ('04/30/2012','MM/DD/YYYY')
ORDER BY 1 -
About trim function capabulity
Hi Experts,
I have a some doubts regarding trim function.
1)trim function any limitations like it will trim for this munch length string(consider adding space also)? please consider in case of trimming spaces
Regards,
SuryaHi, Surya,
surya wrote:
Hi Experts,
I have a some doubts regarding trim function.
1)trim function any limitations like it will trim for this munch length string(consider adding space also)? please consider in case of trimming spaces Good idea; let's simplify the conversation by saying we only want to trim spaces.
TRIM removes all of the spaces, regardless of how many there are.
If you want to limit the number of spaces it removes, then you have to use other functions, either in addition to or instead of TRIM. (REGEXP_REPLACE comes to mind quickly.)
I'm not sure what you're saying about "adding space also". LPAD and RPAD are rather like opposites of LTRIM and RTRIM. (There is no bi-directional PAD function.) RTRIM can remove spaces from the end of a string, RPAD can add spaces to the end of a string.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, showing some strimgs you want to change), and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using. -
Hi:
About HR infotype 0024,As qualification data goes to the OM Infotypes, How to use the function moudle:RHPP_Q_PROFILE_WRITE?
thank you.thank you and the 'BAPI_QUALIPROF_CHANGE' can wok.
DATA:it_profile_add TYPE bapiqualific_tab OCCURS 0 WITH HEADER LINE,
it_profile_delete TYPE bapiqualific_tab OCCURS 0 WITH HEADER LINE,
it_return TYPE bapireturn1 OCCURS 0 WITH HEADER LINE.
it_profile_add-obj_id = '20000116'. "Q ID
it_profile_add-rating = '0001'. "精通程度
APPEND it_profile_add.
CALL FUNCTION 'BAPI_QUALIPROF_CHANGE'
EXPORTING
plvar = '01'
otype = 'AP' "申请者
sobid = '00000170' "PERNR NUMBER
IMPORTING
return = it_return
TABLES
profile_add = it_profile_add
profile_delete = it_profile_delete
ERR_PROFILE =
CHANGE_PROFILE =
READ TABLE it_return WITH KEY type = 'E'.
IF sy-subrc = 0.
MESSAGE 'FAILED' TYPE 'I'.
ELSE.
MESSAGE 'SUCCESS' TYPE 'I'.
ENDIF. -
How to use oracle TRIM functionality in XML messages
When i am selecting data from XML message as per below query, it is returing values correctly.
SELECT extractValue(x.column_value, '/DETAILS/EMPID') as emp_id,
extractValue(x.column_value, '/DETAILS/NAME') as emp_name,
extractValue(x.column_value, '/DETAILS/SALARY') as emp_sal
FROM TABLE(
XMLSequence(
Extract( xmltype('<DETAILS><EMPID>2482</EMPID><NAME>SMITH</NAME><SALARY>4854</SALARY><LOC>CHENNAI</LOC></DETAILS>'),'/DETAILS'))) x;
But when i am selecting data by using below query some additional spaces also coming with column values
SELECT extractValue(x.column_value, '/DETAILS/EMPID') as emp_id,
extractValue(x.column_value, '/DETAILS/NAME') as emp_name,
extractValue(x.column_value, '/DETAILS/SALARY') as emp_sal
FROM TABLE(
XMLSequence(
Extract( xmltype('<DETAILS>
<EMPID>
2482
</EMPID>
<NAME>
SMITH
</NAME>
<SALARY>
4854
</SALARY>
<LOC>
CHENNAI
</LOC>
</DETAILS>'),'/DETAILS'))) x;
Please suggest how to remove additional spaces by using second query.
Thanks
Vikrant Jain.It appears that the ability to use XPath functions in the PATH expression doesn't work prior to 11g :
Connecté à :
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> var xmldoc varchar2(4000)
SQL> begin :xmldoc := '<DETAILS>
2 <EMPID>
3 2482
4 </EMPID>
5 <NAME>
6 SMITH
7 </NAME>
8 <SALARY>
9 4854
10 </SALARY>
11 <LOC>
12 CHENNAI
13 </LOC>
14 </DETAILS>';
15 end;
16 /
Procédure PL/SQL terminée avec succès.
SQL> SELECT emp_id, emp_name, emp_sal
2 FROM XMLTable('/DETAILS'
3 PASSING XMLTYPE(:xmldoc)
4 COLUMNS
5 emp_id NUMBER PATH 'normalize-space(EMPID)',
6 emp_name VARCHAR2(20) PATH 'NAME',
7 emp_sal VARCHAR2(20) PATH 'SALARY');
SELECT emp_id, emp_name, emp_sal
ERREUR à la ligne 1 :
ORA-31011: Echec d'analyse XML
ORA-19202: Une erreur s'est produite lors du traitement la fonction XML (
LPX-00601: Invalid token in: '/*/normalize-space(EMPID)')Using it in XQuery will work though :
SQL> SELECT *
2 FROM XMLTable(
3 'for $i in /DETAILS
4 return element r
5 {
6 for $j in $i/*
7 return element {local-name($j)} {normalize-space($j)}
8 }'
9 PASSING XMLTYPE(:xmldoc)
10 COLUMNS
11 emp_id NUMBER PATH 'EMPID',
12 emp_name VARCHAR2(20) PATH 'NAME',
13 emp_sal NUMBER PATH 'SALARY'
14 );
EMP_ID EMP_NAME EMP_SAL
2482 SMITH 4854 -
Needs help.....Please about using different classes
I don't know how to use differenet classes.
Please tell me how to write class to suit Start. This stuff me up. Please .... help me
<<My program>>
//Start
public class Start
{ private Artist[] Artists;
private Record[] records;
private Person[] Manager;
private TextMenu makeMenu = new TextMenu();
public static void main(String[] args)
Start studio = new Start();
studio.menu();
public Start()
{ //Person.Manager(ManagerName,HouseNumber,StreetNumber,PhoneNumber)
Manager = new Person[1];
Manager[0] = new Person("Yangfan",88,"Young ST",11118888);
//Artist(GroupID,ArtistName,HouseNumber,StreetNumber,PhoneNumber)
Artists = new Artist[5];
Artists[0] = new Artist(1,"Backstreet Boys",58,"Music ST",99998888);
Artists[1] = new Artist(2,"Santana",68,"Music ST",99998899);
Artists[2] = new Artist(3,"Macy Gray",78,"Music ST",55558888);
Artists[3] = new Artist(4,"Ricky Martin",88,"Music AVE",77778888);
Artists[4] = new Artist(5,"Did Rock",55,"Music Road",66667777);
//Record(RecordingID,RecordName,Artist,StartTime,FinishTime,RecordingDate,GuestArtist1,GuestArtist2)
records = new Record[6];
records[0] = new Record(1,"I want it that way",Artists[0],11,12,"05/08/2001",Artists[1],Artists[3]);
records[1] = new Record(2,"Smooth",Artists[1],11,12,"05/08/2001",Artists[1],"");
records[2] = new Record(3,"Do something",Artists[2],11,"05/08/2001",Artists[3],"");
records[3] = new Record(4,"Livin La Vida Loca",Artists[3],11,12,"05/08/2001",Artists[1],Artists[3]);
records[4] = new Record(5,"Bawitdaba",Artists[4],11,13,"05/08/2001",Artists[1],"");
records[5] = new Record(6,"The one",Artists[0],11,14,"05/08/2001",Artists[1],"");
public void menu()
{ String[] choices = {">>>List Manager Details",">>>List All Artist Names",">>>List An Artist Telephone-Number",">>>Show Details For One Recording",">>>Add A New Recording",">>>List The Recording Costs For All Artists",">>>List Artist's Reocording",">>>Exit Program"};
while (true)
{ switch (makeMenu.getChoice(choices))
{ case 1: showAllArtists();
break;
case 2: showAllRecords();
break;
case 3: System.exit(0);
break;
case 4: System.exit(0);
break;
case 5: System.exit(0);
break;
case 6: System.exit(0);
break;
case 7: System.exit(0);
break;
case 8: System.exit(0);
break;
default:
public void showAllArtists()
{ int numArtists = Artists.length;
for(int i = 0; i < numArtists; i++)
{ Artists[i].displayArtistDetails();
public void showAllRecords()
{ for (int i = 0; i < records.length; i++)
{ System.out.println();
records.printRecordDetails();
<<Assignment>>
Due - midnight, Wednesday August 22nd
This assignment will test your knowledge of Java programming using classes, encapsulation and javadoc.
The base requirements
Write a complete Java class to manage a Digital Recording Studio. The studio wants to keep a list of all Artists that use the studio and also wishes to keep track of all Recordings that have been made. An important function of the program is to calculate the time spent making a recording and charge the Artist for the time used.
You must create at least the following classes, Start, Studio, Person, Artist, Recording, Address. You may create other classes if needed as well
Start will contain main(), create one instance of a Studio and execute a Menu of commands to test your code. Studio should contain a studio name, an array of Artist and an array of Recording plus the studio manager (a Person). Each Artist should contain the name of the group and an Address. Each Person will have a name and a home address. Each recording will have a Title (usually song title), an Artist (only one), and a list of guestArtist (they are Artist�s but will not receive royalties) the number of the CD the recording is stored on (numbers are numerical and recordings are saved on CD-R), plus the recording start and finish times for the recording session (suggest you use Java Date class � refer to the API). An Address will contain, house number (integers only), a street name and a telephone number. There is no need to store city and country.
To enter a set of data for testing your program � main() should call a method in the Start class that will fill in a set of values by creating objects and filling in values by calling methods in each class. This is the ONLY method allowed to be longer than 1 page long � normally we would read the data from a file but there are no O-O principles that can be learnt with simply filling in data values. It is suggested to create say at least 4 Artist�s and 6 Recordings (at least one with 1 guest Artist and one with 2 guestArtist�s)
A menu for testing your program should be provided (it is suggested to put the Menu into a separate class as you need at least 3 menus). While other commands are possible, only the following ones will receive marks.
Menu commands needed are
List the Managers name, address and telephone number
List all Artist Names
List an Artist telephone number (a sub menu showing valid Artist�s is required)
Show all details for one Recording ( sub menu of valid Recordings will be needed and remember there can be more than one guestArtist)
Add a new Recording, user will need to be prompted for all details.
List the recording costs for all Artists � show each Artist on a separate line with their name and total amount, charge for using the studio is $1000 per hour or part thereof, example for a 1 hour and 10 minute recording the Artist will be billed for 2 hours.
List all the Recording�s one Artist has worked on (sub menu of Artists needed), the list should show whether they were the Artist or a guestArtist
Exit program
Use fixed sizes for arrays, suggest 20 is suitable for all arrays. Java can handle dynamic data structures (where the number of elements can grow or shrink), but that is beyond a first assignment.
Do NOT make ANY methods static - this defeats the Object Oriented approach and will result in ZERO marks for the entire assignment.
Data MUST be encapsulated, this means that all the data relating to an object are to be stored INSIDE an object. None of the data detail is to be globally available within your program - hence do not store Artist names in either Studio or Recordings � just store a reference instead. Do NOT create ID numbers for Artists, you should use References instead � for many students this will be the hardest part as you have to use Objects, not program in a C style to solve the problem. Note that if there are any non-private data in classes then zero will given for marks for encapsulation.
Good programming style is expected (see web page or lecture notes). In particular, you must use javadoc to generate a set of html pages for your classes. Make sure you use the special javadoc style comments in your source code. Marks will be granted for both using javadoc and also for including sensible javadoc comments on each class and each public method.
What to Hand In
Read the turnin page, basically the .java files, a readme.txt to tell the marker which file the program starts from plus the javadoc (html) files. Do NOT send .class files (if you do send these we will delete them and recompile your program), do NOT compress with gtar, tar, zip or use any other tool on your files. Turnin automatically compresses all your files into a single archive for us to mark.
The simplest way to turnin all your files is to place all files in one directory then just use the *.* wildcard to turn in all files within that one directory.
You must turnin all files that are not part of Java 1.3. In particular, you are allowed (actually encouraged) to use EasyIn or SavitchIn but should include the one you use in the files you submit. It is STRONGLY suggested that you copy all the files into another directory, test it works there by compiling and executing then turnin files from that directory. A common problem is students adding comments at the last minute then not testing if it still compiles. The assignment will be marked as submitted � no asking later for leniency because you added comments at the last minute and failed to check if it still worked.
If the tutors are unable to compile your submission, they will mark the source code but you will lose all the execution marks. Sorry, but it is your responsibility to test then hand in all files.
Comments
For CS807 students, this program should be fairly easy if it was to be programmed in C (you would use several struct). The real art here is to change over to programming objects. Data is contained in an object and is not global. This idea is essential to using Java effectively and is termed encapsulation. Instead of using function(data), you use objectName.method( ). Effectively you switch the data and functions around, the data has a method (function) attached to it, not the other way around as in C (where you have a function and send data to it).
While there will be some marks for execution, the majority of the marks will be given for how well you write your code (including comments and documentation) and for how well you used O-O principles. Programs written in a C style with most of the code in one class or using static will receive ZERO marks regardless of how well they work.
You are responsible for checking your turnin by reading the messages turnin responds with. Failure to read these messages will not be an acceptable excuse for submitting an incorrect assignment. About 2% of assignments sent to turnin are unreadable (usually empty) and obtain 0.
Late submissions
Late submissions will only be accepted with valid reasons for being late. All requests for assignment extensions must be made via email to the lecturer. Replies for acceptance or refusal will made by email. Instant replies are unrealistic (there is usually a flood of queries into my mail box around assignment due dates) and the best advice is to ask at least 4 days in advance so that you will have a reasonable chance of getting a timely reply and allow yourself enough time to submit something on time if the extension is not granted.
ALL late submissions will be marked LAST and will NOT be sent to tutors for marking until all other assignments have been marked. As an example, if you submit late and your assignment is not yet marked by the time assignment 2 is due then it will be pushed to the end of the marking pile as the assignments that were submitted on time for assignment 2 will take priority.
If you make a second submission after the submission date, only the first submission will be marked. We will not mark assignments twice! You can update your submission BEFORE the submission date if you need to - this will just overwrite the first submission. The latest time for a late submission is 5pm on the Wednesday after the due date. This is because, either a solution will be handed out at that lecture or details of the assignment will be discussed at the lecture. I cannot accept any assignment submissions after that time for any reason at all including medical or other valid reasons. For those who are given permission to be later than the maximum submission time � a different assignment will be handed out. Remember, if you decide to submit late you are VERY UNLIKELY to receive feedback on your assignments during semester.
Assignments will be removed from turnin and archived elsewhere then forwarded to tutors for marking on the morning after the assignment is due. A different tutor will mark each of your assignments � do not expect the tutor you see at the tutorials to be your marker.
Marks will be returned via email to your computer science yallara account � ideally within 2 weeks. I will send marks out when I receive them so do not send email asking where your marks are just because a friend has theirs. If you want your email forwarded to an external account, then place a valid .forward file into your yallara account. The Help Desk on level 10 can assist you in setting this up if you do not know how to do it.I have seen other people who have blatantly asked for
other people to do their homework for them, but you
are the first person I've seen to actually cut and
paste the entire assignment as it was handed to you.
Amazing.
Well, unlike some of the people you're talking about, it seems like zyangfan did at least take a stab at it himself, and does have a question that is somewhat more sepcific that "please do this homework for me."
Zyangfan,
marendoj is right, though. Posting the entire assignment is kind of tacky. If you want to post some of it to show us what you're trying to do, please trim it down to the essential points. We don't need to see all the instructor's policies and such.
Anyway, let me see if I understand what you're asking. You said that you know how to write the code, but only by putting it all in one class, is that right? What part about using separate classes do you not understand? Do you not know how to make code in one class aware that the other class exists? Do you not know how code in class A can call a method in class B?
Please be a bit more specifice about what you don't understand. And at least try using multiple classes, then when you can't figure out why something doesn't work, explain what you did, and what you think should have happened, and what did happen instead.
To get you started on the basics (and this should have been covered in your course), you write the code for two classes just like for one class. That is, for class A, you create a file A.java and compile it to A.class. For class B, you create a file B.java and compile it to B.class. Given how rudimentary you question is, we'll skip packages for now. Just put all your class files in the same directory, and don't declare packages in the .java files.
To call a method in class B from code that's in class A, you'll need an object of class B. You instantiate a B, and then call its methods.
public class B {
int count;
public B() { // constructor
public void increment() {
count++;
public class A {
public static void main(String args[]) {
B b = new B();
b.increment();
}Is this what you were asking? -
Using pipelined functions with bind variables in Apex...
Hy all:
I have a table which has about 10 million records and it is hanging up the system when it is trying to retrieve the data from that table... so what I have done is I created a pripelined
function and then trying to retrieve data using an SQL statement ... when I try to use a bind variable to filter by the date and location it is binding according to the location
but not by date ... can anyone help me in this please!!
Help greatly appreciated !
Thanks in advance !Hi Denes:
Create or replace type ohe1 as object (
IMLITM NCHAR(50), IMAITM NCHAR(50), IMDSC1 NCHAR(60), COUNCS NUMBER(22), LIPQOH NUMBER(22),
LIMCU NCHAR(24), LILOCN NCHAR(40), LILOTN NCHAR(60), LILOTS NCHAR(2), IOMMEJ NUMBER(22))
CREATE OR REPLACE TYPE OHE AS TABLE OF Ohe1
CREATE OR REPLACE FUNCTION GET_ohe
return OHE PIPELINED
IS
m_rec ohe1:= ohe1 (NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL,0);
begin
for c in (select f1.LITM LITM, F1.AITM AITM, F1.DSC1 DSC1, F5.UNCS UNCS,
F21.QOH QOH, F21.MCU MCU, F21.LOCN LOCN, F21.LOTN LOTN, F21.LOTS LOTS,
F8.MEJ MEJ FROM F1 F1, F2 F2, F21 F21, F5 F5, F8 F8
WHERE (F5.EDG='07') AND (F21.QOH != 0) AND F2.IBITM = F1.IMITM
AND F21.ITM = F2.ITM AND F21.ITM = F5.ITM AND F21.MCU = F5.MCU
AND F21.MCU = F2.MCU AND F21.LOTN = F8.LOTN AND F21.MCU = F8.MCU)
loop
m_rec.LITM:=c.LITM;
m_rec.AITM:=c.AITM;
m_rec.DSC1:=c.DSC1;
m_rec.UNCS:=c.UNCS;
my_record.QOH:=c.QOH;
my_record.MCU:=c.MCU;
my_record.LOCN:=c.LOCN;
my_record.LOTN:=c.LOTN;
my_record.LOTS:=c.LOTS;
my_record.MEJ:=c.MEJ;
PIPE ROW (my_record);
end loop;
return;
end;
select LITM , AITM , DSC1 , UNCS*.0001 UNCS, QOH*.0001 QOH, (UNCS*.0001)*(QOH*.0001) AMOUNT,
MCU MCU, LOCN LOCN, LOTN LOTN, LOTS LOTS, jdate(DECODE(MEJ,0,100001,MEJ)) MEJ FROM
TABLE (GET_ohe)
WHERE trim(LIMCU)= TRIM(:OHE_BRANCHID)
AND (jdate(DECODE(MEJ,0,10001,MEJ)) >=:FROMEXPDT
AND jdate(DECODE(MEJ,0,10001,MEJ)) <=:TOEXPDATE)
The MEJ is a julian date and I am trying to convert it into a date ..... using the function jdate! and the pipelined function is created without any errors
and I am able to get the data with correct branch location bind variable but only problem is it is not binding the date filters in the sql.....
Thanks
Edited by: user10183758 on Oct 16, 2008 8:17 AM -
I am trying to edit video clips from about two yesrs worth of video for an iMovie. I don't want to load all of the clips into a new event because it would be hours worth of video. I don't even know if iMovie could handle it. I have tried to use Quicktime Player to do this, but the "trim" function under the edit menu is gray and won't let me do anything. What can I do?
Thank you so much!
It works!
I used this code...
videoDisplay.addEventListener(VideoEvent.COMPLETE, videoCompleteHandler);
private function videoCompleteHandler(event:VideoEvent):void {
hideVideo();
private function hideVideo():void {
this.visible = false;
this.includeInLayout = false;
I have a follow up question...
What is the syntax to target the video player from a different component to add an event listener to a button in the Sharing Widget called Back to Video?
Thanks!!
DK -
Convert smartform output in to PDF using CONVERT_OTF function how to do it
Hi Anil , and Hi All
I am trying to display smartforms output in java webdynpro
for that i have got the following code in sdn.
can anybody please clarify these doubts in the below code
1) What are the mandatory input and output parameters
I have to pass here in this code to my application
2) please check my previous post also in this regards please
. Please reply at the very earliest. Check the below code
Convert smartform output in to PDF using CONVERT_OTF function module and you can write pdf using parameter 'binfile' of this function in WebDynpro using the following code:
It is copied from my prg. I hope you understand it.
public void onActionGetQuote(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionGetQuote(ServerEvent)
wdThis.wdGetOppt_QwriterCustController().executeZquote_Writer_Input();
String fileName = wdContext.currentZquote_Writer_InputElement().getOrder().toString().trim() + System.currentTimeMillis() + ".pdf";
String pdfOutput = new String(wdContext.currentOutputElement().getBinfile());
if (pdfOutput != null)
try
String pdfResoucePath = WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(), fileName);
FileOutputStream fileOutputStream = new FileOutputStream(new File(pdfResoucePath));
PrintStream ps = new PrintStream(fileOutputStream);
ps.print(pdfOutput);
ps.close();
//Display the PDF to the browser
String fileURL = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getDeployableObjectPart(), fileName);
IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(fileURL, "Pdf Browser", false);
window.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
window.removeWindowFeature(WDWindowFeature.MENU_BAR);
window.removeWindowFeature(WDWindowFeature.STATUS_BAR);
window.removeWindowFeature(WDWindowFeature.TOOL_BAR);
window.open();
// To collect all the file created in the server by user
quoteFiles.add(quoteFiles.size(), pdfResoucePath);
} catch (Exception e)
throw new WDRuntimeException(e);
//@@endHi
ABAPers prepared a BAPI function module which calls Smart form , how can i execute it from java Webdynpro, so that I can display the smart form in Webdynpro. Pleas reply at the very earliest. Every answer will be rewarded.
regards
jalandhar -
Hi,
we have FR Studio (client, v. 11.1.1.3.0238 and Report Server v. 11.1.1.3.0.0301) distributed on Citrix terminal server (windows 2003 32-bit) and on latest 2 prod servers we have this error "You're not authorized to use this function. Contact your administrator." appearing.
On QA server FR Studio works fine, we had an issue there when we forgot to set ports
8295-8299 to "listening mode" = they were not defined on FR server's FR_servp.properties config files.
This is also fixed on Prod FR servers and we have double checked firewalls are open.
After adding them to QA FR servers we had no issues with FR Studio on QA, but on PROD the issue still exists.
We have also checked that this shouldn' have anything to do with authentication.
Odd thing is that we get at least partially same sort of error messages on both working and non-working FRClient.log files.
On FRClient.log there are for example following records:
08-04 09:26:11 ERROR ConfigResourceBundle Could not find fr_configcache.properties file
08-04 09:26:11 ERROR SerializableResourceBundle Could not get registry instance
08-04 09:26:11 ERROR SerializableResourceBundle java.io.FileNotFoundException: C:\Apps\Hyperion\common\config\9.5.0.0\reg.properties (The system cannot find the file specified)
com.hyperion.hit.registry.exceptions.RegistryException: java.io.FileNotFoundException: C:\Apps\Hyperion\common\config\9.5.0.0\reg.properties (The system cannot find the file specified)
at com.hyperion.hit.registry.RegistryUtils.createNewConnection(RegistryUtils.java:158)
at com.hyperion.hit.registry.RegistryConnection.getInstance(RegistryConnection.java:155)
at com.hyperion.hit.registry.Registry.getInstance(Registry.java:309).....
Caused by: java.io.FileNotFoundException: C:\Apps\Hyperion\common\config\9.5.0.0\reg.properties (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at com.hyperion.hit.registry.RegistryUtils.createNewConnection(RegistryUtils.java:151)
... 15 more
08-04 09:26:11 ERROR HRResourceBundleFactory Could not locate registry
08-04 09:26:11 ERROR HRResourceBundleFactory 5500
com.hyperion.reporting.util.HyperionReportException: Server not yet configured. Please configure the server.
at com.hyperion.reporting.config.ConfigResourceBundle.<init>(Unknown Source)
at com.hyperion.reporting.config.ConfigResourceBundle.getInstance(Unknown Source)
at com.hyperion.reporting.config.HRResourceBundleFactory.getConfigBundle(Unknown Source)...
That propably gives already an idea what FR Studio is logging.
Does anyone have idea about this .properties file for frconfig cache?
Should that be defined somehow during system configuration as we don't find that from any of our environments?
Just for additional info:
We have used following packages and installed HFM Admin Client, FR Studio and EPMA File Generator GUI.
• 02. installer - V17382-01.zip
• 03. foundation 1 of 4 - V17397-01.zip
• 03. foundation 2 of 4 - V17369-01.zip
• 04. architect - V17398-01.zip
• 08. financial reporting - V17378-01.zip
• 11. financial management - V17365-01.zip
Patches:
+ hfm_11113_50-p9976978_111130_WINNT.zip
+ financial reporting_11113_20-p9657652_11113_WINNT.zip
During the installation we selected:
Foundation \
Performance Management Architect\Performance Management Architect File Generator
Financial Management\
Financial Management Client
Financial ManagementADM Driver
Financial Reporting\
Financial Reporting Studio Client
I noticed that apparently no configuration was run neither in QA or in PROD, not sure though if FR Studio even requires that? HFM Admin Client does work on all environments Citrix servers.
But in Dev and LAB where FR Studio is working fine - FRClient logs absolutely no recods at all and there we did run configuration to tell which SQL db is on background.
Not sure though whether that config run has any significance for FR Studio.
Sorry for extremely long story, but just in case if anybody has faced similar issues and whether there could be something with Windows server settings I should go and check?
Btw... even adding this fr_configcache.properties manually (to try to highlight FR server name and port) it seems FR Client can't find the file.
Br, MJKDenis,
Thank you for the prompt reply.
>
Denis Konovalov wrote:
> if those reports were saved with security - you're not goingt o be able to open them with Xi3.1 Deski.
Forgive me for my mundane question but what does saving with security mean?
Thanks
Maybe you are looking for
-
Is there a way of getting Firefox to automaticly import the Explorer settings upon install?
Hi! I'm trying to repack Firefox 3.6.3 into a MSI for a deployment install trough-out our organization. Since we're using Explorer as the default browser at the moment our users have all their bookmarks and such stored in Explorer. Now I'm wondering.
-
How do I get the sound back on my iPhone 4? I've tried all the fixes such as restarting iPhone, reinstalling the audible app, and finally yesterday, I restored the phone to its factory settings. I still get no sound from music on iTunes or from my
-
We have an iPhone 4S and can only see the top half of the screen.
We have an iPhone 4s and can only see the top half of the screen. The phone works fine as far as making calls and you can kind of text, if you can figure out where the keypad is. Is there a fix for this or is it trash? It is out of warranty and we
-
[SOLVED]gcc-libs and gcc-libs-multilib are in conflict
Can't update today. [glow@GlowArch ~]$ sudo pacman -Syuv :: Synchronizing package databases... core is up to date extra is up to date community is up to date multilib is up to date catalyst is up to date :: Starting full system upgrade... warning: an
-
ADD a new connection to sql developer
Hi, i downloaded the sql developer from the main site .i tried to adding a new connection.it showed the error no network adapter found . first let me confirm one thing the database name and username,password are predefined ones are should i need to c