Akdora’s Blog

Programming, Oracle, Life, Fun

ORA-02064: Distributed Operation not Supported September 11, 2009

Filed under: PL/SQL — akdora @ 11:06 am
Tags: , , , , ,

After a short investigation, I did not see this comment:

We can not run a PL/SQL block contains a DDL (Data Definition Language)  command via a db_link :)

ORA-02064: distributed operation not supported
ORA-06512: at "FRAUD.FN_FCMS_BTG", line 3
----- PL/SQL Call Stack -----
 object      line  object
 handle    number  name
7000000c984d720        10  anonymous block

On DB A we write such a funciton:

CREATE OR REPLACE FUNCTION FN_FCMS_BTG RETURN NUMBER IS
BEGIN
 EXECUTE IMMEDIATE 'create table aaaaaaa as select * from f1_segment_1';
 RETURN 1;
END;

Then, we call it from DB B:

DECLARE
 I NUMBER;
BEGIN
 I := FN_FCMS_BTG@MY_LINK;
EXCEPTION
 WHEN OTHERS THEN
 DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_ERROR_STACK ||
 DBMS_UTILITY.FORMAT_CALL_STACK);
END;

NOTE: Since TRUNCATE is a DDL command, we cannot also use it in the same way ;)

(more…)

 

ORA-06508 PL/SQL: could not find program unit being called September 11, 2009

When you search this error on the net, you will find out these :

Cause: An attempt was made to call a stored program that could not be found. The program may have been dropped or incompatibly modified, or have compiled with errors.
Action: Check that all referenced programs, including their package bodies, exist and are compatible.

Yes, that’s true. But if you have lots of objects depends to a lot of object :) You will need to more information to fix this error. If you face up with this error, you probably use SQLCODE and SQLERRM in your exception block of your PL/SQL code. Something  like this:

BEGIN
 NULL;
EXCEPTION
 WHEN OTHERS THEN
 ROLLBACK;
 INSERT_LOG(SQLCODE, SQLERRM);
END;

I do not advise to handle errors in this way. Because this error description does not give you enough information abour your error as ORA-06508 error. You don’t really know what triggered this exception. Operation of this code on a production database is also not easy. At this point, Oracle’s DBMS_UTILITY package will be included in out lives. :)

If you write something like this:

(more…)

 

Sending mail with CLOB attachment August 13, 2009

Filed under: Oracle, PL/SQL — akdora @ 6:15 am
Tags: , , , , , , , , , ,

I needed to send an e-mail with Excel file attachment. I realize that there is not enough documentation about sending mail in CLOB filetype attachment.

Here is our procedure:

CREATE OR REPLACE PROCEDURE SENDMAIL_ATT
(
 MSG_FROM     VARCHAR2,
 MSG_TO       VARCHAR2,
 MSG_SUBJECT  VARCHAR2,
 MSG_TEXT     VARCHAR2,
 MSG_ATT      CLOB,
 ATT_FILENAME VARCHAR2
) IS

 V_MAILHOST VARCHAR2(50) := 'mailhost';
 V_PORT     NUMBER(2) := 25;
 V_HELO     VARCHAR2(50) := 'localhost';
 (more...)
 

Google App Engine Example August 13, 2009

Filed under: Non-technical — akdora @ 5:24 am
Tags: , , ,
 

Turkcell Hatlar için Lokasyon Bilgisi February 25, 2009

Filed under: Non-technical — akdora @ 7:10 am

ACIL ya da NEREDEYIM yazıp 7777 veya 2222 numarasına mesaj gönderilirse, aşağıdaki mesaj gönderiliyor. Normalde 2 sms / 4 kontör. Fakat kontörü olmasa da mesaj gönderiliyor… Acil durumlarda kullanılabilir.

 

Gelen bilgi mesajı;
BULUNDUGUNUZ BOLGE
Istanbul,Kadikoy,Icerenkoy,Karaman Ciftlik Yolu Caddesi
COGRAFI KONUMUNUZ
(40derece 58dk 44sn Kuzey,29derece 06dk 22sn Dogu)
SIZE EN YAKIN NOKTALAR
Tem Buro Amirligi 103m(+902164104113), Ozel Avicenna Hastanesi 225m(+902165741000), Infotech Bilisim ve Iletisim Teknolojileri A.S. 32m(+902165740505)

 

Google Maps on Phone with latitude attribute. February 25, 2009

Filed under: Non-technical — akdora @ 7:04 am
Tags: , , ,

I just discovered Google Maps using on my phone with Google Latitude attribute. After installing google maps on your phone, You may also start using latitude from the menu of the phone. When you login your google account, you can select your friends to share your current location.
They can see where you are and you can seee where they are. Ever your phone does not suppoer GPS, you can use it by connecting internet.
We had a lot of fun with this implementation :) It’s also useful to get together in crowded places. Thanks again google..

For more information :
http://www.google.com/mobile/default/maps.html
http://m.google.com/maps for google maps for phones.
http://m.google.com/latitude for latitude.
 

Turkish Character Problem (Türkçe Karakter Problemi) February 23, 2009

When we write jsp pages, we add the following code to the page to encode the characters in desired charset.

<%@ page contentType="text/html;charset=iso-8859-9"%>

Although to add this code, we sometimes face up the character problem.  Expecially, if we change the mimeType of the page. I mean, export the page as excel.

(If you want to export any data in a excel file from jsp, change the mimetpye of the jsp and write your data in table tags)

if (pageType != null && pageType.equalsIgnoreCase("excel")) {
   String mimeType = "application/vnd.ms-excel;charset=ISO-8859-9";
   response.setContentType(mimeType);
   String filename = "MyExcelFile";
   response.setHeader("Content-Disposition","attachment;filename=" + filename + ".xls");
   //System.out.println(response.getCharacterEncoding());
}

When you get this problem, try to add the following code in the HEAD tag of the page. It will fixed up.

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9">

 I searched this simple code for a long time:), because it think that the first code enough to encode the charset. But it is not.

 

Turkcell Teknoloji 2009 Yaz Dönemi Başvuruları February 23, 2009

Filed under: Non-technical — akdora @ 1:14 pm

2009 yaz dönemi staj dönemi için www.turkcellteknoloji.com.tr web sitemizden “İnsan Kaynakları/Açık Pozisyonlar/Turkcell Teknoloji 2009 Paf Takımı” (http://www.turkcellteknoloji.com.tr/HumanResources/Paf2009.aspx) altından başvurular toplanıyor. Turkcell ve grup şirketlerinin web sitelerinden yapılan tüm başvurular kariyer.net ortak database inde toplanacaktır.

 

Rules of Precedence in SQL Where Clause February 18, 2009

Filed under: SQL — akdora @ 8:49 pm
Tags: , , ,

Expressions in where clause process in the following order:

Number Expression
1 Arithmetic Operators
2 Concatenation Operator
3 Comparision Condition
4 IS [NOT] NULL, LIKE, [NOT] IN
5 [NOT] BETWEEN
6 Not Equal To
7 NOT Logical Condition
8 AND Logical Condition
9 OR Logical Condition

 

For example on AND and OR conditions:

Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
 
SQL> set serveroutput on
 
SQL>
SQL> SELECT t.employee_id, t.first_name, t.last_name, t.salary  ,t.manager_id
  2    FROM employees t
  3   WHERE t.salary > 15000
  4         AND t.manager_id = 100
  5         OR t.manager_id = 103;
 (more...)
 

Turkish Oracle Video Source (Oracle Video Sunumlar, Egitimler) February 18, 2009

Filed under: Non-technical — akdora @ 8:49 am