Cant compile this function
Hi
I cant compile and excute this function
/* Where can I declare or execute this fields */
CREATE TYPE typ_get_brandings as object(
BRANDING_CODE varchar2(200),
NAME_DESC varchar2(200)
/* Where can I declare or execute this fields */
CREATE TYPE tab_get_brandings is table of typ_get_brandings
CREATE FUNCTION get_brandings
RETURN tab_get_brandings
IS
l_brandings tab_get_brandings;
BEGIN
SELECT typ_get_brandings( b.BRANDING_CODE,C.NAME_DESC)
into l_brandings
from development.brandings b,godot.company c
where b.company_id = c.company_id
return l_brandings;
EXCEPTION
WHEN OTHERS THEN
CORPORATE.COMMON.EXCEPTION_LOG( 'DEVELOPMENT.BRANDING_ADMIN.GET_BRANDING', SQLCODE, SQLERRM, null, FALSE );
return SQLCODE;
END;
Please help
1008783 wrote:
Hi
I cant compile and excute this function
/* Where can I declare or execute this fields */
CREATE TYPE typ_get_brandings as object(
BRANDING_CODE varchar2(200),
NAME_DESC varchar2(200)
/* Where can I declare or execute this fields */
CREATE TYPE tab_get_brandings is table of typ_get_brandings
CREATE FUNCTION get_brandings
RETURN tab_get_brandings
IS
l_brandings tab_get_brandings;
BEGIN
SELECT typ_get_brandings( b.BRANDING_CODE,C.NAME_DESC)
into l_brandings
from development.brandings b,godot.company c
where b.company_id = c.company_id
return l_brandings;
EXCEPTION
WHEN OTHERS THEN
CORPORATE.COMMON.EXCEPTION_LOG( 'DEVELOPMENT.BRANDING_ADMIN.GET_BRANDING', SQLCODE, SQLERRM, null, FALSE );
return SQLCODE;
END;
Please helpHi ,
Why you wanna create object ? any specific requirement?
create table plch_test(id number,name varchar2(30));
insert into plch_test values(1,'ram');
insert into plch_test values(2,'abhi');
insert into plch_test values(3,'aksi');
CREATE OR REPLACE FUNCTION PLCH_FNC(p_id IN plch_test.id%TYPE)
RETURN plch_test%ROWTYPE
IS
rec_plch_test plch_test%ROWTYPE;
BEGIN
SELECT id,name
INTO rec_plch_test
FROM plch_test
WHERE id=p_id;
EXCEPTION WHEN NO_DATA_FOUND THEN
rec_plch_test:=null;
RETURN rec_plch_test;
END;Call the function
SQL> set serveroutput on
SQL> DECLARE
2 rec_plch plch_test%ROWTYPE;
3 BEGIN
4 rec_plch:=PLCH_FNC(1);
5 dbms_output.put_line('ID'||' '||rec_plch.id||' '||'NAME'||' '||rec_plch.name);
6 END;
7 .
SQL> /
ID 1 NAME ram
PL/SQL procedure successfully completed.
SQL> DECLARE
2 rec_plch plch_test%ROWTYPE;
3 BEGIN
4 rec_plch:=PLCH_FNC(2);
5 dbms_output.put_line('ID'||' '||rec_plch.id||' '||'NAME'||' '||rec_plch.name);
6 END;
7 .
SQL> /
ID 2 NAME abhi
PL/SQL procedure successfully completed.
SQL> Regards,
Achyut Kotekal
Edited by: Achyut K on Jun 6, 2013 12:03 AM
Similar Messages
-
Hello all,
am using weblogic8.1, first of all I would like to know do we need to give a name("Advisor") in JNDI in weblogic, as its mentioned in HFEJB page52 for RI Server. if you say that we have give the JNDI name in weblogic,
where do we ned to give?
this is place where I stand now...
AdviceBean.ejb
package headfirst;
import javax.ejb.*;
import weblogic.ejb.*;
import headfirst.*;
* @ejbgen:session
* ejb-name = "Advice"
* @ejbgen:jndi-name
* remote = "ejb.AdviceRemoteHome"
* @ejbgen:file-generation remote-class = "true" remote-class-name = "AdviceRemote" remote-home = "true" remote-home-name = "AdviceHome" local-class = "false" local-class-name = "AdviceLocal" local-home = "false" local-home-name = "AdviceLocalHome"
public class AdviceBean implements SessionBean {
// OK, not very exciting advice! You should come up with something better...
private String[] adviceStrings = {"test", "test1", "test2", "test3"};
public void ejbActivate() {
System.out.println("ejb activate");
public void ejbPassivate() {
System.out.println("ejb passivate");
public void ejbRemove() {
System.out.println("ejb remove");
public void setSessionContext(SessionContext ctx) {
System.out.println("session context");
// this business method name is changed from the book, because
// there of a bug on some versions of the J2EE RI
public String getMessage() {
System.out.println("in get advice");
int random = (int) (Math.random() * adviceStrings.length);
return adviceStrings[random];
public void ejbCreate() {
System.out.println("in ejb create");
AdviceClient.java
package headfirst;
import javax.naming.*;
import java.rmi.*;
import javax.rmi.*;
import headfirst.*;
import javax.ejb.*;
// not all of these imports are used in this code...
// but in a real client you'd probably need at least
// java.rmi.RemoteException and javax.ejb.CreateException
public class AdviceClient {
public static void main(String[] args) {
new AdviceClient().go();
public void go() {
try {
Context ic = new InitialContext();
Object o = ic.lookup("Advisor"); // replace with YOUR JNDI name for the bean
AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o, AdviceHome.class);
Advice advisor = home.create();
System.out.println(advisor.getMessage());
} catch (Exception ex) {
ex.printStackTrace();
I cant able to build with this file D:\Weblogic\user_projects\AdviceApp\AdviceApp\headfirst\AdviceClient.java
So I remove this client file for a while to build the .jar
after removing this client file, I can able to build. Done, now i got the AdviceApp.jar. again I brought back the client file to the same place..
I tried from cmd
D:\Weblogic\user_projects\AdviceApp\AdviceApp\headfirst>javac -classpath "C:\Program Files\j2sdkee1.3.1\lib\j2ee.jar";"D:\Weblogic\user_projects\AdviceApp\Advic
eApp\AdviceApp.jar" AdviceClient.java
AdviceClient.java:28: cannot resolve symbol
symbol : class Advice
location: class headfirst.AdviceClient
Advice advisor = home.create();
^
1 error
Please tel me how to get rid of this issue...1008783 wrote:
Hi
I cant compile and excute this function
/* Where can I declare or execute this fields */
CREATE TYPE typ_get_brandings as object(
BRANDING_CODE varchar2(200),
NAME_DESC varchar2(200)
/* Where can I declare or execute this fields */
CREATE TYPE tab_get_brandings is table of typ_get_brandings
CREATE FUNCTION get_brandings
RETURN tab_get_brandings
IS
l_brandings tab_get_brandings;
BEGIN
SELECT typ_get_brandings( b.BRANDING_CODE,C.NAME_DESC)
into l_brandings
from development.brandings b,godot.company c
where b.company_id = c.company_id
return l_brandings;
EXCEPTION
WHEN OTHERS THEN
CORPORATE.COMMON.EXCEPTION_LOG( 'DEVELOPMENT.BRANDING_ADMIN.GET_BRANDING', SQLCODE, SQLERRM, null, FALSE );
return SQLCODE;
END;
Please helpHi ,
Why you wanna create object ? any specific requirement?
create table plch_test(id number,name varchar2(30));
insert into plch_test values(1,'ram');
insert into plch_test values(2,'abhi');
insert into plch_test values(3,'aksi');
CREATE OR REPLACE FUNCTION PLCH_FNC(p_id IN plch_test.id%TYPE)
RETURN plch_test%ROWTYPE
IS
rec_plch_test plch_test%ROWTYPE;
BEGIN
SELECT id,name
INTO rec_plch_test
FROM plch_test
WHERE id=p_id;
EXCEPTION WHEN NO_DATA_FOUND THEN
rec_plch_test:=null;
RETURN rec_plch_test;
END;Call the function
SQL> set serveroutput on
SQL> DECLARE
2 rec_plch plch_test%ROWTYPE;
3 BEGIN
4 rec_plch:=PLCH_FNC(1);
5 dbms_output.put_line('ID'||' '||rec_plch.id||' '||'NAME'||' '||rec_plch.name);
6 END;
7 .
SQL> /
ID 1 NAME ram
PL/SQL procedure successfully completed.
SQL> DECLARE
2 rec_plch plch_test%ROWTYPE;
3 BEGIN
4 rec_plch:=PLCH_FNC(2);
5 dbms_output.put_line('ID'||' '||rec_plch.id||' '||'NAME'||' '||rec_plch.name);
6 END;
7 .
SQL> /
ID 2 NAME abhi
PL/SQL procedure successfully completed.
SQL> Regards,
Achyut Kotekal
Edited by: Achyut K on Jun 6, 2013 12:03 AM -
What's wrong with this function
What's wrong with this Function(PL/SQL) in this formaula column definition in Reports 6i
function currdateFormula return Date is
curr_date date;
begin
select to_char(sysdate, 'DD-MM-YYYY') into curr_date from dual;
return(curr_date);
end;
I get the following error in compiling
REP-1401. 'currdateformula'.Fatal PL/SQL error occured. ORA-01843 not a valid month.
The SQL select to_char(sysdate, 'DD-MM-YYYY') from dual; worked well in SQL Plus prompt.
I got a clean compile when i use just sysdate in the function (see below).
function currdateFormula return Date is
curr_date date;
begin
select sysdate into curr_date from dual;
return(curr_date);
end;
Appreciate your help
Raja Lakshmihello,
what you are trying to do :
fetch the current date and return it as the result of the formula-column.
what you are actually doing :
fetch the current date, convert it to text, assign this text to a date-variable which causes an implicit type-conversion.
in your case you create a date-string with the format dd-mm-yyyy. the implicit conversion then tries to convert this string back to date using the NLS settings of your session. depending on your NLS_LANG and NLS_DATE_FORMAT this might work, if your session-date-format is dd-mm-yyyy which obviously it is NOT as you get the error.
what you should do :
select sysdate into curr_date from dual;
this fetches the sysdate and stores it in your date-variable. there is no type conversion needed what so ever.
regards,
the oracle reports team -
Hello,
I start from the end and details show below - this error message i got in sql session:
SQL> select count(*) from EnergyType@ENERGOPLAN;
select count(*) from EnergyType@ENERGOPLAN
ERROR at line 1:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[unixODBC][Driver Manager]Driver does not support this function {IM001}
ORA-02063: preceding 2 lines from ENERGOPLAN
SQL>
First question - is Oracle Heterogeneous Services are licensed for standard edition ? I cant find this information, and my database - is SE 11.2.0.3.0 - 64bit.
If its ok and HS are licensed for SE, then please see details of my problem:
----OS and packages version
[oracle@aris_sv_db log]$ uname -a
Linux aris_sv_db 2.6.18-308.24.1.el5 #1 SMP Tue Dec 4 17:43:34 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
[oracle@aris_sv_db log]$
[oracle@aris_sv_db log]$ rpm -qa | grep odbc
[oracle@aris_sv_db log]$ rpm -qa | grep unixodbc
[oracle@aris_sv_db log]$ rpm -qa | grep unixODBC
unixODBC-libs-2.2.11-10.el5
unixODBC-libs-2.2.11-10.el5
unixODBC-devel-2.2.11-10.el5
unixODBC-2.2.11-10.el5
unixODBC-devel-2.2.11-10.el5
[oracle@aris_sv_db log]$ rpm -qa | grep freetds
freetds-0.91-1.el5.rf
[oracle@aris_sv_db log]$
-----ODBC.INI, ODBCINST.INI and FREETDS.CONF
[oracle@aris_sv_db log]$ more /home/oracle/.odbc.ini
[ENERGOPLAN]
Driver = FreeTDS
Servername = ENERGOPLAN
Database = ess2
[oracle@aris_sv_db log]$
[oracle@aris_sv_db log]$ more /etc/odbcinst.ini
# Example driver definitions
[FreeTDS]
Description = MSSQL Driver
Driver = /usr/lib64/libtdsodbc.so.0
#Setup = /usr/lib64/libtdsodbc.so.0
#Driver = /usr/lib64/libodbc.so
#Driver = /usr/lib/libodbc.so
UsageCount = 1
Trace = Yes
TraceFile = /tmp/freetds.log
[ODBC]
DEBUG = 1
TraceFile = /tmp/sqltrace.log
Trace = Yes
[oracle@aris_sv_db log]$
[oracle@aris_sv_db log]$ more /etc/freetds.conf
# A typical Microsoft server
[ENERGOPLAN]
host = 192.168.10.64
port = 1433
tds version = 8.0
# client charset = UTF-8
client charset = cp1251
[oracle@aris_sv_db log]$
----CHECK CONNECT from ODBC
[oracle@aris_sv_db log]$ isql -v ENERGOPLAN user pass
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
SQL> select count(*) from EnergyType;
| |
| 8 |
SQLRowCount returns 1
1 rows fetched
SQL> [oracle@aris_sv_db log]$ tsql -S ENERGOPLAN -U user -P pass
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "cp1251"
1> select count(*) from EnergyType;
2> go
8
(1 row affected)
1> [oracle@aris_sv_db log]$
----LISTENER.ORA, TNSNAMES and initENERGOPLAN.ora
[oracle@aris_sv_db log]$ more /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
SID_LIST_ENERGOPLAN =
(SID_LIST =
(SID_DESC=
(SID_NAME=ENERGOPLAN)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
(PROGRAM=dg4odbc)
(ENVS="LD_LIBRARY_PATH=/usr/lib64:/u01/app/oracle/product/11.2.0/dbhome_1/lib")
ENERGOPLAN =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = PNPKEY))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.72)(PORT = 1523))
ADR_BASE_LISTENER = /u01/app/oracle
[oracle@aris_sv_db log]$ more /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
ENERGOPLAN =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.72)(PORT=1523))
(CONNECT_DATA=(SID=ENERGOPLAN))
(HS=OK)
[oracle@aris_sv_db log]$ more /u01/app/oracle/product/11.2.0/dbhome_1/hs/admin/initENERGOPLAN.ora
# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC
# HS init parameters
HS_FDS_CONNECT_INFO = ENERGOPLAN
#HS_FDS_CONNECT_INFO = 192.168.0.199:1433//test
HS_FDS_TRACE_LEVEL = DEBUG
#HS_FDS_TRACE_FILE_NAME = /tmp/hs1.log
HS_FDS_TRACE_FILE_NAME = /u01/app/oracle/product/11.2.0/dbhome_1/hs/log/mytrace.log
HS_FDS_SHAREABLE_NAME = /usr/lib64/libodbc.so #/usr/lib64/libtdsodbc.so.0
#HS_FDS_SHAREABLE_NAME = /usr/lib64/libtdsodbc.so.0
#HS_FDS_SHAREABLE_NAME = /usr/lib/libodbc.so
#HS_LANGUAGE=american_america.we8iso8859p1
#HS_LANGUAGE=AMERICAN_AMERICA.AL32UTF8
#HS_LANGUAGE=AMERICAN_AMERICA.CL8MSWIN1251
#HS_LANGUAGE=RUSSIAN_RUSSIA.UTF8
#HS_LANGUAGE=Russian_CIS.AL32UTF-8
#HS_FDS_FETCH_ROWS=1
HS_NLS_NCHAR = UCS2
HS_FDS_SQLLEN_INTERPRETATION=32
# ODBC specific environment variables
set ODBCINI=/home/oracle/.odbc.ini
set ODBCINSTINI=/etc/odbcinst.ini
#HS_KEEP_REMOTE_COLUMN_SIZE=ALL
#HS_NLS_LENGTH_SEMANTICS=CHAR
#HS_FDS_SUPPORT_STATISTICS=FALSE
# Environment variables required for the non-Oracle system
#set <envvar>=<value>
[oracle@aris_sv_db log]$
[oracle@aris_sv_db log]$ tnsping ENERGOPLAN
TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 01-APR-2013 16:27:49
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.72)(PORT=1523)) (CONNECT_DATA=(SID=ENERGOPLAN)) (HS=OK))
OK (0 msec)
[oracle@aris_sv_db log]$
----CREATE DBLINK and test from sqlplus
CREATE DATABASE LINK "ENERGOPLAN" CONNECT TO "user" IDENTIFIED BY "pass" USING 'ENERGOPLAN';
[oracle@aris_sv_db log]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Apr 1 16:30:14 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
SQL> select count(*) from EnergyType@ENERGOPLAN;
select count(*) from EnergyType@ENERGOPLAN
ERROR at line 1:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[unixODBC][Driver Manager]Driver does not support this function {IM001}
ORA-02063: preceding 2 lines from ENERGOPLAN
SQL>
----logs from hs and odbc
[oracle@aris_sv_db log]$ tail -50 ENERGOPLAN_agt_12117.trc
12 VARCHAR N 100 100 0/ 0 1000 0 200 ConsumptionYearCostUOM
3 DECIMAL N 24 24 9/ 3 0 0 0 ConsumptionYearFactorAmount
-7 BIT N 1 1 0/ 0 0 0 20 NeedToBeApprovedByREK
Exiting hgodtab, rc=0 at 2013/04/01-16:30:42
Entered hgodafr, cursor id 0 at 2013/04/01-16:30:42
Free hoada @ 0x14e5fd20
Exiting hgodafr, rc=0 at 2013/04/01-16:30:42
Entered hgopars, cursor id 1 at 2013/04/01-16:30:42
type:0
SQL text from hgopars, id=1, len=36 ...
00: 53454C45 43542043 4F554E54 282A2920 [SELECT COUNT(*) ]
10: 46524F4D 2022454E 45524759 54595045 [FROM "ENERGYTYPE]
20: 22204131 [" A1]
Exiting hgopars, rc=0 at 2013/04/01-16:30:42
Entered hgoopen, cursor id 1 at 2013/04/01-16:30:42
hgoopen, line 87: NO hoada to print
Deferred open until first fetch.
Exiting hgoopen, rc=0 at 2013/04/01-16:30:42
Entered hgodscr, cursor id 1 at 2013/04/01-16:30:42
Allocate hoada @ 0x14e5fd80
Entered hgodscr_process_sellist_description at 2013/04/01-16:30:42
Entered hgopcda at 2013/04/01-16:30:42
Column:1(): dtype:4 (INTEGER), prc/scl:10/0, nullbl:1, octet:0, sign:1, radix:0
Exiting hgopcda, rc=0 at 2013/04/01-16:30:42
Entered hgopoer at 2013/04/01-16:30:42
hgopoer, line 231: got native error 0 and sqlstate IM001; message follows...
[unixODBC][Driver Manager]Driver does not support this function {IM001}
Exiting hgopoer, rc=0 at 2013/04/01-16:30:42
hgodscr, line 407: calling SQLSetStmtAttr got sqlstate IM001
Free hoada @ 0x14e5fd80
hgodscr, line 464: NO hoada to print
Exiting hgodscr, rc=28500 at 2013/04/01-16:30:42 with error ptr FILE:hgodscr.c LINE:407 FUNCTION:hgodscr() ID:Set array fetch size
Entered hgoclse, cursor id 1 at 2013/04/01-16:31:24
Exiting hgoclse, rc=0 at 2013/04/01-16:31:24
Entered hgocomm at 2013/04/01-16:31:24
keepinfo:0, tflag:1
00: 4F52434C 2E343535 32623466 342E362E [ORCL.4552b4f4.6.]
10: 32322E37 363237 [22.7627]
tbid (len 20) is ...
00: 4F52434C 5B362E32 322E3736 32375D5B [ORCL[6.22.7627][]
10: 312E345D [1.4]]
cmt(0):
Entered hgocpctx at 2013/04/01-16:31:24
Exiting hgocpctx, rc=0 at 2013/04/01-16:31:24
Exiting hgocomm, rc=0 at 2013/04/01-16:31:24
Entered hgolgof at 2013/04/01-16:31:24
tflag:1
Exiting hgolgof, rc=0 at 2013/04/01-16:31:24
Entered hgoexit at 2013/04/01-16:31:24
Exiting hgoexit, rc=0
[oracle@aris_sv_db log]$
[oracle@aris_sv_db log]$ tail -50 /tmp/sqltrace.log
Native = 0x7fff6ca974f4
Message Text = 0x14e5f968
Buffer Length = 510
Text Len Ptr = 0x7fff6ca97750
[ODBC][12117][SQLGetDiagRecW.c][582]
Exit:[SQL_SUCCESS]
SQLState = IM001
Native = 0x7fff6ca974f4 -> 0
Message Text = [[unixODBC][Driver Manager]Driver does not support this function]
[ODBC][12117][SQLGetDiagRecW.c][540]
Entry:
Statement = 0x14e399f0
Rec Number = 2
SQLState = 0x7fff6ca97700
Native = 0x7fff6ca974f4
Message Text = 0x14e5f908
Buffer Length = 510
Text Len Ptr = 0x7fff6ca97750
[ODBC][12117][SQLGetDiagRecW.c][582]
Exit:[SQL_NO_DATA]
[ODBC][12117][SQLEndTran.c][315]
Entry:
Connection = 0x14dbd4b0
Completion Type = 0
[ODBC][12117][SQLGetInfo.c][214]
Entry:
Connection = 0x14dbd4b0
Info Type = SQL_CURSOR_COMMIT_BEHAVIOR (23)
Info Value = 0x7fff6ca9781e
Buffer Length = 8
StrLen = 0x7fff6ca9781c
[ODBC][12117][SQLGetInfo.c][528]
Exit:[SQL_SUCCESS]
[ODBC][12117][SQLEndTran.c][488]
Exit:[SQL_SUCCESS]
[ODBC][12117][SQLDisconnect.c][204]
Entry:
Connection = 0x14dbd4b0
[ODBC][12117][SQLDisconnect.c][341]
Exit:[SQL_SUCCESS]
[ODBC][12117][SQLFreeHandle.c][268]
Entry:
Handle Type = 2
Input Handle = 0x14dbd4b0
[ODBC][12117][SQLFreeHandle.c][317]
Exit:[SQL_SUCCESS]
[ODBC][12117][SQLFreeHandle.c][203]
Entry:
Handle Type = 1
Input Handle = 0x14dbb0c0
[oracle@aris_sv_db log]$To see which ODBC function DG4ODBC is looking for and unixODBC isn't supporting it would be best to get an ODBC trace file. But as your unixODBC driver (unixODBC-2.2.11-10.el5) is outdated and these old drivers had a lot of issues when being used on 64bit operating systems (for example wrong sizeofint etc). So best would be to update the unixODBC Driver manager to release 2.3.x. More details can be found on the web site: www.unicodbc.org
- Klaus -
Eclipse: UFL "u212com.dll" that implements this function is missing
Dear Sirs,
I try to open one of our reports with the "Crystal Reports for Eclipse 2.0" sample application. Thie report relies on a com based UFL. I get the following error message:
Crystal Reports Viewer
Exception yadada...
UFL "u212com.dll" that implements this function is missing
OK
How can I fix this?
Thanks for your answers.The fact that you can see the UFL under 'Additional Functions' tells me that the UFL is compiled as 32 bit. This is good for creating the report in the IDE which is 32 bit. But the app you are building is compiled as 64 bit. But there is no 64 bit UFL(?) that yo have built so far. So, two options;
1) Build the UFL as "Any CPU". I am not sure if this will actually work. never tried this, but I do know that it is not possible to compile an app using the CR runtime as "Any CPU". E.g.; we always recommend to compile either as 32 bit and \ or 64 bit, not "Any CPU" This may be the case with the UFL, thus the next suggestion.
2) Compile a second copy of the UFL as 64 bit. You'll then have to use 64 bit GAC and regasm on that dll.
- Ludek -
UFL 'u212com.dll' that implements this function is missing
I am attempting to write a user function library for the crystal reports version that ships with Visual Studio 2010. Following the walkthrough on the Business Objects website (although that is for VS2005) I have successfully created my .dll file and added it to the GAC, and it appears in the function list under 'Additional Functions' in the Crystal Reports formula editor. However when I use the function on in my Windows forms application, I get the error "UFL 'u212com.dll' that implements this function is missing.". This is on my development machine and I have installed the latest service pack for Crystal Reports for VS2010 (64-bit). My OS is Windows 7 64-bit.
I have two questions:
1) What version of the .NET framework should my class library be targeting? My windows forms application targets the .NET framework version 4, but should I be doing the same thing for the .dll for Crystal Reports? It does show up in the formula editor though, so I guess that means that Crystal Reports recognises it correctly.
2) I have done a search on the PC for the file 'u212com.dll' and it is in the folder C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win64_x64 (and also in the equivalent 32-bit folder) Is this correct, or is there is a specific 64-bit version of this file?
Or is it something else that I am missing? Thanks in advance for any suggestions.The fact that you can see the UFL under 'Additional Functions' tells me that the UFL is compiled as 32 bit. This is good for creating the report in the IDE which is 32 bit. But the app you are building is compiled as 64 bit. But there is no 64 bit UFL(?) that yo have built so far. So, two options;
1) Build the UFL as "Any CPU". I am not sure if this will actually work. never tried this, but I do know that it is not possible to compile an app using the CR runtime as "Any CPU". E.g.; we always recommend to compile either as 32 bit and \ or 64 bit, not "Any CPU" This may be the case with the UFL, thus the next suggestion.
2) Compile a second copy of the UFL as 64 bit. You'll then have to use 64 bit GAC and regasm on that dll.
- Ludek -
the InitCVIRTE function is not listed in the NIDAQ function reference online help? Why? and what does she do?and where can I find a description of this function? Can i use this function with visualc++ 6.0?
The InitCVIRTE function is in the CVI run time engine (cvirte.dll)..not part of NI-DAQ.
Applications written or using CVI may call this function..
How are you running into this ?
From the CVI help...
This function performs initialization of the CVI Run-Time Engine. It is needed only in executables or DLLs that are linked using an external compiler. Otherwise, it is harmless.
It should be called in your main, WinMain, or DllMain, function. The parameter values you should pass depend on which of these three functions you are calling InitCVIRTE from. The following examples show how to use InitCVIRTE in each case.
If you are using main, your code should be as follows.
int main (int argc, char *argv[])
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
/* your other code */
return 0;
If you are using WinMain, your code should be as follows.
int __stdcall WinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdLine,
int nCmdShow)
if (InitCVIRTE (hInstance, 0, 0) == 0)
return -1; /* out of memory */
/* your other code */
return 0;
If you are creating a DLL, you must call InitCVIRTE and CloseCVIRTE in your DllMain function, as in the following.
int __stdcall DllMain (void *hinstDLL, int fdwReason,
void *lpvReserved)
if (fdwReason == DLL_PROCESS_ATTACH)
if (InitCVIRTE (hinstDLL, 0, 0) == 0)
return 0; /* out of memory */
/* your other ATTACH code */
else if (fdwReason == DLL_PROCESS_DETACH)
/* your other DETACH code */
CloseCVIRTE ();
return 1;
NOTE: The prototype for InitCVIRTE is in cvirte.h, not
utility.h.
NOTE: In CVI 4.0.1, this function was expanded from one to
three parameters. Executables and DLLs that were
created using the one-parameter version of the function
will continue to work properly.
/*-------------------- Prototype ---------------------*/
int InitCVIRTE (void *HInstance, char *Argv[], void *Reserved);
Nandan Dharwadker
Staff Software Engineer
Measurement Studio Hardware Team -
I am not sure how to call this Function correctly and how to pass the IN parameter, I am still new and learning, please help!
So far I have compiled it, and it compiled fine and saved it in my schema.
It is supposed to be able to calculate the compression ratio for say TABLE_1234 to see how much space it would save if
I used the COMPRESS option in 10G.
CREATE OR REPLACE function Y775.compression_ratio (tabname varchar2)
return number is
pragma autonomous_transaction;
-- sample percentage
pct number := 0.000099;
-- original block count (should be less than 10k)
blkcnt number := 0;
-- compressed block count
blkcntc number;
begin
execute immediate ' create table TEMP_UNCOMPRESSED pctfree 0
as select * from ' || tabname ||
' where rownum < 1';
while ((pct < 100) and (blkcnt < 1000)) loop
execute immediate 'truncate table TEMP_UNCOMPRESSED';
execute immediate 'insert into TEMP_UNCOMPRESSED select * from ' ||
tabname || ' sample block (' || pct || ',10)';
execute immediate 'select
count(distinct(dbms_rowid.rowid_block_number(rowid)))
from TEMP_UNCOMPRESSED' into blkcnt;
pct := pct * 10;
end loop;
execute immediate 'create table TEMP_COMPRESSED compress as
select * from TEMP_UNCOMPRESSED';
execute immediate 'select
count(distinct(dbms_rowid.rowid_block_number(rowid)))
from TEMP_COMPRESSED' into blkcntc;
execute immediate 'drop table TEMP_COMPRESSED';
execute immediate 'drop table TEMP_UNCOMPRESSED';
return (blkcnt/blkcntc);
end;
/Ok, ok - so I have updated the function and it compiled, fine, but now nothing is returned, I thought that a number was returned ?
CREATE OR REPLACE function Y775.compression_ratio (tabname varchar2)
return number
AUTHID CURRENT_USER
is
pragma autonomous_transaction;
-- sample percentage
pct number := 0.000099;
-- original block count (should be less than 10k)
blkcnt number := 0;
-- compressed block count
blkcntc number;
begin
execute immediate ' create table TEMP_UNCOMPRESSED pctfree 0
as select * from ' || tabname ||
' where rownum < 1';
while ((pct < 100) and (blkcnt < 1000)) loop
execute immediate 'truncate table TEMP_UNCOMPRESSED';
execute immediate 'insert into TEMP_UNCOMPRESSED select * from ' ||
tabname || ' sample block (' || pct || ',10)';
execute immediate 'select
count(distinct(dbms_rowid.rowid_block_number(rowid)))
from TEMP_UNCOMPRESSED' into blkcnt;
pct := pct * 10;
end loop;
execute immediate 'create table TEMP_COMPRESSED compress as
select * from TEMP_UNCOMPRESSED';
execute immediate 'select
count(distinct(dbms_rowid.rowid_block_number(rowid)))
from TEMP_COMPRESSED' into blkcntc;
execute immediate 'drop table TEMP_COMPRESSED';
execute immediate 'drop table TEMP_UNCOMPRESSED';
return (blkcnt/blkcntc);
end;
/ -
How can I compile all functions, procedures and packages with a script?
I need to compile all functions, procedures and packages of 5 schemas (users) with a script.
How can I do it?
Thanks!you can create a script to select all invalid objects in those schemas Since Oracle 8 introduced NDS this approach has struck me as a trifle old fashioned. It's much simpler to loop round the query in PL/SQL and use EXECUTE IMMEDIATE to fire off the DDL statements. No scripts, no muss, no fuss.
Having said that, the problem with this approach and also with using DBMS_UTILITY.COMPILE_SCHEMA is that they do not compile all the invalid objects in dependency order. This may result in programs being invalidated by the subsequent compilation of dependencies. This is due to the introduction of Java into the database.
The UTLRP script is much better, because it (usually) avoids cyclic references. But you still may need to run it more than once.
In general it is better to avoid sledgehammer recompilations (like DBMS_UTILITY.COMPILE_SCHEMA, which starts by invalidating all the objects). If we have twenty invalid objects, nineteen of which are dependencies of the twentieth, we actually only need to recompile the master object, as recompiling it will trigger the recompilation of all the others.
Cheers, APC -
Xine-lib-vdpau-hg cant compile
Hi,
I try to compile this package for use vdpau with xine , but no luck..
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../include -I../.. -I../../include -I../../include -I../../src -I../../src/xine-engine -I../../src/xine-engine -I../../src/xine-utils -I../../src/input -I../../src/input -I../../lib -I../../lib -DNDEBUG -D_REENTRANT -DXINE_COMPILE -O3 -ffast-math -fexpensive-optimizations -fvisibility=hidden -fno-strict-aliasing -pipe -Wall -Wformat=2 -Wno-format-zero-length -Wmissing-format-attribute -Werror-implicit-function-declaration -Wstrict-aliasing=2 -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -Wpointer-arith -g -march=x86-64 -mtune=generic -O2 -pipe -Wall -Wchar-subscripts -Wnested-externs -Wcast-align -Wmissing-declarations -Wmissing-prototypes -Wmissing-format-attribute -Wno-pointer-sign -Wformat=2 -Wno-format-zero-length -Wstrict-aliasing=2 -Werror=implicit-function-declaration -MT xineplug_vo_out_xxmc_la-video_out_xxmc.lo -MD -MP -MF .deps/xineplug_vo_out_xxmc_la-video_out_xxmc.Tpo -c video_out_xxmc.c -fPIC -DPIC -o .libs/xineplug_vo_out_xxmc_la-video_out_xxmc.o
video_out_xxmc.c: In function 'xxmc_xvmc_destroy_surfaces':
video_out_xxmc.c:181:7: error: implicit declaration of function 'XvMCFlushSurface'
video_out_xxmc.c:181:7: warning: nested extern declaration of 'XvMCFlushSurface'
video_out_xxmc.c:182:7: error: implicit declaration of function 'XvMCSyncSurface'
video_out_xxmc.c:182:7: warning: nested extern declaration of 'XvMCSyncSurface'
video_out_xxmc.c:183:7: error: implicit declaration of function 'XvMCHideSurface'
video_out_xxmc.c:183:7: warning: nested extern declaration of 'XvMCHideSurface'
video_out_xxmc.c:184:7: error: implicit declaration of function 'XvMCDestroySurface'
video_out_xxmc.c:184:7: warning: nested extern declaration of 'XvMCDestroySurface'
video_out_xxmc.c: In function 'xxmc_xvmc_destroy_subpictures':
video_out_xxmc.c:202:7: error: implicit declaration of function 'XvMCFlushSubpicture'
video_out_xxmc.c:202:7: warning: nested extern declaration of 'XvMCFlushSubpicture'
video_out_xxmc.c:203:7: error: implicit declaration of function 'XvMCSyncSubpicture'
video_out_xxmc.c:203:7: warning: nested extern declaration of 'XvMCSyncSubpicture'
video_out_xxmc.c:204:7: error: implicit declaration of function 'XvMCDestroySubpicture'
video_out_xxmc.c:204:7: warning: nested extern declaration of 'XvMCDestroySubpicture'
video_out_xxmc.c: In function 'xxmc_xvmc_alloc_surface':
video_out_xxmc.c:231:7: error: implicit declaration of function 'XvMCCreateSurface'
video_out_xxmc.c:231:7: warning: nested extern declaration of 'XvMCCreateSurface'
video_out_xxmc.c: In function 'xxmc_xvmc_alloc_subpicture':
video_out_xxmc.c:293:7: error: implicit declaration of function 'XvMCGetSubpictureStatus'
video_out_xxmc.c:293:7: warning: nested extern declaration of 'XvMCGetSubpictureStatus'
video_out_xxmc.c:310:7: error: implicit declaration of function 'XvMCCreateSubpicture'
video_out_xxmc.c:310:7: warning: nested extern declaration of 'XvMCCreateSubpicture'
video_out_xxmc.c: In function 'xxmc_duplicate_frame_data':
video_out_xxmc.c:479:5: error: implicit declaration of function 'XvMCClearSubpicture'
video_out_xxmc.c:479:5: warning: nested extern declaration of 'XvMCClearSubpicture'
video_out_xxmc.c:481:5: error: implicit declaration of function 'XvMCBlendSubpicture2'
video_out_xxmc.c:481:5: warning: nested extern declaration of 'XvMCBlendSubpicture2'
video_out_xxmc.c: In function 'xxmc_dispose_context':
video_out_xxmc.c:759:7: error: implicit declaration of function 'XvMCDestroyMacroBlocks'
video_out_xxmc.c:759:7: warning: nested extern declaration of 'XvMCDestroyMacroBlocks'
video_out_xxmc.c:760:7: error: implicit declaration of function 'XvMCDestroyBlocks'
video_out_xxmc.c:760:7: warning: nested extern declaration of 'XvMCDestroyBlocks'
video_out_xxmc.c:777:5: error: implicit declaration of function 'XvMCDestroyContext'
video_out_xxmc.c:777:5: warning: nested extern declaration of 'XvMCDestroyContext'
video_out_xxmc.c: In function 'xxmc_create_context':
video_out_xxmc.c:846:3: error: implicit declaration of function 'XvMCCreateContext'
video_out_xxmc.c:846:3: warning: nested extern declaration of 'XvMCCreateContext'
video_out_xxmc.c: In function 'xxmc_mocomp_create_macroblocks':
video_out_xxmc.c:920:5: error: implicit declaration of function 'XvMCCreateMacroBlocks'
video_out_xxmc.c:920:5: warning: nested extern declaration of 'XvMCCreateMacroBlocks'
video_out_xxmc.c:923:5: error: implicit declaration of function 'XvMCCreateBlocks'
video_out_xxmc.c:923:5: warning: nested extern declaration of 'XvMCCreateBlocks'
video_out_xxmc.c: In function 'xvmc_check_colorkey_properties':
video_out_xxmc.c:952:5: error: implicit declaration of function 'XvMCQueryAttributes'
video_out_xxmc.c:952:5: warning: nested extern declaration of 'XvMCQueryAttributes'
video_out_xxmc.c:952:21: warning: assignment makes pointer from integer without a cast
video_out_xxmc.c:959:4: error: implicit declaration of function 'XvMCSetAttribute'
video_out_xxmc.c:959:4: warning: nested extern declaration of 'XvMCSetAttribute'
video_out_xxmc.c: In function 'xxmc_overlay_end':
video_out_xxmc.c:1485:10: warning: passing argument 6 of '_x_xx44_to_xvmc_palette' discards qualifiers from pointer target type
../../include/xine/alphablend.h:107:6: note: expected 'char *' but argument is of type 'const char *'
video_out_xxmc.c:1487:2: error: implicit declaration of function 'XvMCSetSubpicturePalette'
video_out_xxmc.c:1487:2: warning: nested extern declaration of 'XvMCSetSubpicturePalette'
video_out_xxmc.c:1497:2: error: implicit declaration of function 'XvMCBlendSubpicture'
video_out_xxmc.c:1497:2: warning: nested extern declaration of 'XvMCBlendSubpicture'
video_out_xxmc.c: In function 'xxmc_overlay_blend':
video_out_xxmc.c:1561:6: error: implicit declaration of function 'XvMCCompositeSubpicture'
video_out_xxmc.c:1561:6: warning: nested extern declaration of 'XvMCCompositeSubpicture'
video_out_xxmc.c: In function 'xxmc_display_frame':
video_out_xxmc.c:1720:5: error: implicit declaration of function 'XvMCPutSurface'
video_out_xxmc.c:1720:5: warning: nested extern declaration of 'XvMCPutSurface'
video_out_xxmc.c: In function 'checkXvMCCap':
video_out_xxmc.c:2309:3: error: implicit declaration of function 'XvMCQueryExtension'
video_out_xxmc.c:2309:3: warning: nested extern declaration of 'XvMCQueryExtension'
video_out_xxmc.c:2318:3: error: implicit declaration of function 'XvMCListSurfaceTypes'
video_out_xxmc.c:2318:3: warning: nested extern declaration of 'XvMCListSurfaceTypes'
video_out_xxmc.c:2318:15: warning: assignment makes pointer from integer without a cast
video_out_xxmc.c:2363:7: error: implicit declaration of function 'XvMCListSubpictureTypes'
video_out_xxmc.c:2363:7: warning: nested extern declaration of 'XvMCListSubpictureTypes'
video_out_xxmc.c:2363:20: warning: assignment makes pointer from integer without a cast
video_out_xxmc.c: In function 'open_plugin':
video_out_xxmc.c:2488:12: warning: passing argument 4 of 'config->register_enum' from incompatible pointer type
video_out_xxmc.c:2488:12: note: expected 'char **' but argument is of type 'const char * const*'
video_out_xxmc.c:2492:7: warning: format '%d' expects type 'int', but argument 5 has type 'XvPortID'
video_out_xxmc.c:2659:8: warning: passing argument 4 of 'config->register_enum' from incompatible pointer type
video_out_xxmc.c:2659:8: note: expected 'char **' but argument is of type 'const char * const*'
make[3]: *** [xineplug_vo_out_xxmc_la-video_out_xxmc.lo] Error 1
make[3]: Leaving directory `/var/abs/local/yaourtbuild/xine-lib-vdpau-hg/src/xine-lib-build/src/video_out'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/var/abs/local/yaourtbuild/xine-lib-vdpau-hg/src/xine-lib-build/src/video_out'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/abs/local/yaourtbuild/xine-lib-vdpau-hg/src/xine-lib-build/src'
make: *** [all-recursive] Error 1
Aborting...
==> ERROR: Makepkg was unable to build xine-lib-vdpau-hg.
==> Restart building xine-lib-vdpau-hg ? [y/N]
Its sound something with libxvmc, but i dint find the clue, any tip is really welcomed..thx!!!Your problem sounds similar to this one, except that they're using software raid rather than just pure LVM. If you're using an initrd, you may not have the appropriate modules installed. If you're not using an initrd, then the kernel probably needs LVM support compiled in (not as a module) and could be solved by fixing that. I have never used the ck-patchset, but this should give you an additional data point.
Also comment=systemd.automount will be deprecated soon as I understand it; if you have a need for automounting, x-systemd.automount should be used instead. -
Can't compile stored functions in forms trigger
I have put this code in POST_QUERY trigger. But it does not compile.
select substr(wds(round(d2h(h2d(max(to_number(to_char(msg_time))))
- h2d(min(to_number(to_char(msg_time))))),2)),1,40) into :tm1 from test_hst_msg;
Please note all the fucntions are existed and are successfully compiled.
It is giving compilation error.
function 'WDS' may not be used in sql.
do you have any remeady to anyone.
Thanks.May need to add PRAGMA RESTRICT_REFERENCES compiler directive.
-
[solved]Cant compile networkmanager-l2tp-git
yes, i installed openswan-systemd+xl2tpd , both works well for me(kernel3.6.9, pure systemd)
When i try to complie networkmanager-l2tp-git, i got these errors:
nm-l2tp-service.c: In function ‘main’:
nm-l2tp-service.c:1642:35: error: ‘NM_L2TP_LOCALEDIR’ undeclared (first use in this function)
nm-l2tp-service.c:1642:35: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [nm-l2tp-service.o] Error 1
make[3]: *** Waiting for unfinished jobs....
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I/usr/include/NetworkManager -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/libnm-glib -Wall -std=gnu89 -march=native -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -Wshadow -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wstrict-prototypes -Wfloat-equal -Wno-unused-parameter -Wno-sign-compare -fno-strict-aliasing -Wno-unused-but-set-variable -Werror -MT nm_l2tp_pppd_plugin_la-nm-l2tp-pppd-plugin.lo -MD -MP -MF .deps/nm_l2tp_pppd_plugin_la-nm-l2tp-pppd-plugin.Tpo -c nm-l2tp-pppd-plugin.c -o nm_l2tp_pppd_plugin_la-nm-l2tp-pppd-plugin.o >/dev/null 2>&1
mv -f .deps/nm_l2tp_pppd_plugin_la-nm-l2tp-pppd-plugin.Tpo .deps/nm_l2tp_pppd_plugin_la-nm-l2tp-pppd-plugin.Plo
make[3]: Leaving directory `/tmp/yaourt-tmp-genio/aur-networkmanager-l2tp-git/src/NetworkManager-l2tp-build/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/tmp/yaourt-tmp-genio/aur-networkmanager-l2tp-git/src/NetworkManager-l2tp-build/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/yaourt-tmp-genio/aur-networkmanager-l2tp-git/src/NetworkManager-l2tp-build'
Last edited by genio4urlife (2012-12-06 11:51:24)If you have posted it here:
https://aur.archlinux.org/packages.php?ID=51831
and it solved your problem, please, mark your thread "solved"
Last edited by scar (2012-12-06 08:53:17) -
What's wrong in this function?
What's wrong in this function?
create or replace function user_info (p_id in number,
p_key_name in varchar2)
return varchar2 is
l_text varchar2(200);
l_return_value varchar2(300);
begin
l_text := 'wwsec_api.person_info('||p_id||').'||p_key_name;
execute immediate l_text into l_return_value;
return l_return_value;
end;if u first time creating . remove the word "or replace"
if u already create it with the compilation error then use the word "as" instead of "is". -
Ok, im new to numbers but i cant work this one out. I have 4 columns. A and B have different values. Column C is an average of hours worked. When column C is less then 8 i need column D to equal column A. When column C is equal or greater then 8 i need column D to equal the sum of A and B.
Hi Lucas,
Try this:
Formula in D2 (and Fill Down) =IF(C2<8, A2,A2+B2)
The IF function follows the logic of if, then, else.
IF(this is true, then do this, else do that)
If it is raining, then stay at home, else hold a picnic .
Regards,
Ian. -
Can someone else try to compile this and see why the program is returning..
Can someone else try to compile this and see why the program is returning "false" when I try to delete the files on exit (at bottom of code)... I have the source code uploaded to the web as well as my 2 text test files inside a zip file(they need to be unzipped so you can try to test the program) and .class file... the program works the way i want it to, but i just can't seem to delete the 3 temporary files i use... why??? why does it return false???
Thanks in advance,
Disco Hristo
http://www.holytrinity-holycross.org/DiscoHristo/Assemble.java
http://www.holytrinity-holycross.org/DiscoHristo/Assemble.class
http://www.holytrinity-holycross.org/DiscoHristo/tests.zip
* Assemble.java 1.0 02/06/22
* @author Disco Hristo
* @version 1.0
import java.io.*;
import java.lang.*;
import java.util.*;
public class Assemble
public static void main(String args[]) throws IOException
if (args.length > 0) // Checks to see if there are any arguments
printArgumentInfo ();
else // if no arguments run the program
getInput ();
printToFile ();
deleteFiles ();
public static void getInput () throws IOException
// Gets the input and then send it to 3 files according to Tags
File head = new File ("head.chris");
PrintStream headStream = new PrintStream (new FileOutputStream (head));
File body = new File ("body.chris");
PrintStream bodyStream = new PrintStream (new FileOutputStream (body));
File foot = new File ("foot.chris");
PrintStream footStream = new PrintStream (new FileOutputStream (foot));
String input; // String used to store input
File d = new File(".");
String files[] = d.list();
for (int n=0; n!=files.length; n++)
if (files[n].endsWith(".txt") == true)
String fileName = files[n];
BufferedReader in = new BufferedReader (new FileReader(fileName));
while (true)
input = in.readLine();
if (input != null)
input = input.trim();
if (input == null) // if no more input
break;
else if ( (input.compareTo("<HEAD>")) == 0) // if start of <HEAD> text
do
input = in.readLine();
if (input != null)
input = input.trim();
if ( ((input.compareTo("<BODY>")) == 0) ||
((input.compareTo("<FOOT>")) == 0) ||
((input.compareTo("</BODY>")) == 0) ||
((input.compareTo("</FOOT>")) == 0) ||
((input.compareTo("<HEAD>")) == 0))
//checks to see if tags in input are in correct order
System.out.println("Input Is Incorrectly Formatted - Tag Error");
System.out.println("Close your <HEAD> tag before starting another tag.");
System.exit(1); //exit program without printing data
if ( (input.compareTo("</HEAD>")) != 0) //if not end of tag
headStream.println(input); //print to text file
while ( (input.compareTo("</HEAD>")) != 0);
else if ( (input.compareTo("<BODY>")) == 0) // if start of <BODY> text
do
input = in.readLine();
if (input != null)
input = input.trim();
if ( ((input.compareTo("<HEAD>")) == 0) ||
((input.compareTo("<FOOT>")) == 0) ||
((input.compareTo("</HEAD>")) == 0) ||
((input.compareTo("</FOOT>")) == 0) ||
((input.compareTo("<BODY>")) == 0))
//checks to see if tags in input are in correct order
System.out.println("Input Is Incorrectly Formatted - Tag Error");
System.out.println("Close your <BODY> tag before starting another tag.");
System.exit(1); //exit program without printing data
if ( (input.compareTo("</BODY>")) != 0) //if not end of tag
bodyStream.println(input); //print to text file
while ( (input.compareTo("</BODY>")) != 0);
else if ( (input.compareTo("<FOOT>")) == 0) // if start of <FOOT> text
do
input = in.readLine();
if (input != null)
input = input.trim();
if ( ((input.compareTo("<BODY>")) == 0) ||
((input.compareTo("<HEAD>")) == 0) ||
((input.compareTo("</BODY>")) == 0) ||
((input.compareTo("</HEAD>")) == 0) ||
((input.compareTo("<FOOT>")) == 0))
//checks to see if tags in input are in correct order
System.out.println("Input Is Incorrectly Formatted - Tag Error");
System.out.println("Close your <FOOT> tag before starting another tag.");
System.exit(1); //exit program without printing data
if ( (input.compareTo("</FOOT>")) != 0) //if not end of tag
footStream.println(input); //print to text file
while ( (input.compareTo("</FOOT>")) != 0);
else
break;
public static void printToFile () throws IOException
// Prints the text from head.txt, body.txt, and foot.txt to the output.log
File head = new File ("head.chris");
FileReader headReader = new FileReader(head);
BufferedReader inHead = new BufferedReader(headReader);
File body = new File ("body.chris");
FileReader bodyReader = new FileReader(body);
BufferedReader inBody = new BufferedReader(bodyReader);
File foot = new File ("foot.chris");
FileReader footReader = new FileReader(foot);
BufferedReader inFoot = new BufferedReader(footReader);
PrintStream outputStream = new PrintStream (new FileOutputStream (new File("output.log")));
String output; //string used to store output
while (true)
output = inHead.readLine();
if (output == null) //if no more text to get from file
break;
else
outputStream.println(output); // print to output.log
while (true)
output = inBody.readLine();
if (output == null)// if no more text to get from file
break;
else
outputStream.println(output); // print to output.log
while (true)
output = inFoot.readLine();
if (output == null) //if no more text to get from file
break;
else
outputStream.println(output); // print to output.log
//Close up the files
inHead.close ();
inBody.close ();
inFoot.close ();
outputStream.close ();
public static void printArgumentInfo () // Prints argument info to screen
System.out.println("");
System.out.println("Disco Hristo");
System.out.println("");
System.out.println("Assemble.class is a small program that");
System.out.println("takes in as input a body of text and then");
System.out.println("outputs the text in an order according to");
System.out.println("the tags that are placed in the input.");
public static void deleteFiles ()
File deleteHead = new File ("head.chris");
File deleteBody = new File ("body.chris");
File deleteFoot = new File ("foot.chris");
deleteHead.deleteOnExit();
deleteBody.deleteOnExit();
deleteFoot.deleteOnExit();
}I tired your program, it still gives false for files deleted. I tool the same functions you used in your program and ran it. The files get deleted. Tried this :
<pre>
import java.io.*;
import java.lang.*;
import java.util.*;
public class FileTest {
public static void main(String args[]) {
FileTest f = new FileTest();
try {
f.createFile();
f.deleteFile();
} catch(IOException ioe){
System.out.println(ioe.getMessage());
public void createFile() throws IOException {
System.out.println("In create file method...");
File test = new File("test1.txt");
File tst = new File("text2.txt");
PrintStream testStream = new PrintStream (new FileOutputStream (test));
PrintStream tstStream = new PrintStream (new FileOutputStream (tst));
testStream.println("this is a test to delete a file");
tstStream.println("this is the second file created");
testStream.close();
tstStream.close();
public void deleteFile() throws IOException {
File test = new File("test1.txt");
File tst = new File("text2.txt");
System.out.println(test.delete());
System.out.println(tst.delete());
</pre>
Also check the starting and closing braces for your if..else blocks.
-Siva
Maybe you are looking for
-
I have: MS 6390 LE w/ lan v 1.00 AMD XP 1700 w/hsf 30G WD hard drive 5400rpm 128 M ddr266 memory Antec case with an Antec sl300 PSU floppy zip 100 MS 8348 Dragonwriter CD RW(currently not working yet, but am working on that too) Everything seems to b
-
I cant get rid of the yahoo bookmark in my bookmarks toolbar, just like a disease it wont just go away, how can I get rid of this pest?
-
When apple is bringing back full screen caller picture
Any news when apple is bringing back fullscreen caller picture...after ios 7.1 interface looks like cheap phones.
-
HT1338 just re installed my mac what is causing it to ask for password when i am not using the mac
question as above ,please help anyone,regards peter.
-
Imac problem with amd radeon 6970m
I live in Kazakhstan where hasn't got any authorized apple services! But my iMac 2011 has problem with amd radeon 6970m. And i need to repair it but i dont know how to do it! Please help me!