Archive for the ‘oracle’ Category

today one of my collague asked me to how to fetch all rows of a parameter table in a single row with .

so i wrote this.

select * from
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 1),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 2),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 3),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 4),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 5),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 6),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 7),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 8),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 9),
(select * from (select rownum as rnum, c.* from ( select b.* from user.test b order by rowid) c) where rnum = 10)

example gets 1o rows in a single row, actually it was constant 78 rows.
so he could used it like
resultset.getString(“param1″+i) with a loop.

and then he also needed 5 by 5 collected results with 2x columns in each view.

and my solution is

select * from
(select rownum as rx, b.* from (
select rownum as rnum, rowid as rid, a.* from (select param_a, param_b, param_c, param_d, param_e from user.test order by param_a, param_b, param_c) a) b
where rnum >=5 and rnum < 10) x,
(select rownum as rx, b.* from (
select rownum as rnum, rowid as rid, a.* from (select param_a, param_b, param_c, param_d, param_e from user.test order by param_a, param_b, param_c) a) b
where rnum >=10 and rnum < 15) y where x.rnum + 5 = y.rnum ;

anyone knows easier and more optimised way to do these?

Bookmark and Share
Tags: , , , ,

Bilginiz üzere coğrafi veriyi da olarak saklıyoruz, bu güne kadar managerlar aracılığıyla bu veriye bakamıyorduk, bunun için sonu CAD le biten ya da GEO ile başlıyan yazılımlar kullanıyorduk, işte bu sorunu çözüyor. bir eklenti olarak çalışarak veriyi sağ tıkladığınızda görüntü almanızı ve katman özelliklerini incelemenizi sağlıyor, ayrıca index hazırlamanızı kolaylaştırıyor.
GeoRaptor Spatial Viewer for ORACLE SQLDEVELOPER
Peki nasıl yükleyeceğiz;
SqlDeveloperda
Yardım menüsündeki güncelleme seçeneğini tıklayın, güncellemenin ikinci basamağına
Name: GeoRaptor
Location: http://georaptor.sourceforge.net/install.xml

şeklinde GeoRaptoru ekleyin.
sonra güncellemeyi ilerleyerek bitirin.

SqlDeveloperı yeniden başlattığınızda, GeoRaptoru view penceresinden açarak altta göstericisinin yer almasını sağlıyabilirsiniz.

Daha sonra tablo isimleri ya da veri satırlarını sağ tıklayarak bu göstericide izleyebiliyorsunuz.

Bookmark and Share
Tags: , , , , , ,

make and _HOME configuration as prior post.
i precompiled , grab it from here.

you are ready :)

Bookmark and Share
Tags: , ,

first we take rpm packages from
oracle instant client downloads.
you need to download devel, basic, sqlplus packages.
we need alien to convert rpms to deb.
sudo apt-get install alien
convert them to deb packges;
alien -instantclient11.2-basic_11.2.0.1.0-2_i386.rpm
alien oracle-instantclient11.2-devel_11.2.0.1.0-2_i386.rpm
alien oracle-instantclient11.2-sqlplus_11.2.0.1.0-2_i386.rpm

install new deb packages with sudo dpkg -i

download and install the libaio library
libaio, libao-dev
give this commands;

sudo echo "/usr/lib/oracle/11.2/client/lib" > /etc/ld.so.conf.d/oracle.conf
sudo ldconfig
export ORACLE_HOME=/usr/lib/oracle/11.2/client
sudo "export ORACLE_HOME=/usr/lib/oracle/11.2/client" > ~/._profile

take package from proturk

wget http://www.proturk.com/downloads/tora_2.1.1-1_i386.deb
sudo dpkg -i tora_2.1.1-1_i386.deb

now you can run tora with /usr/local/tora/bin/tora command.

if it not works probably you dont have qtscintilla or qt4 libraries, install them with synaptic.

if you want to compile by yourself, here is the configure command;
./configure --with-instant-client=/usr/lib/oracle/11.2/client --with-oracle-includes=/usr/include/oracle/11.2/client --with-oracle-libraries=/usr/lib/oracle/11.2/client/lib --with-oci-version=11G

Bookmark and Share
Tags: , , , ,
15
Mar

oracle XMLType kullanımı

   Posted by: Muhammed YÜRÜRDURMAZ Tags: , , , ,

Öncelikli olarak tipinde bir tablo oluşturalım. Tablo adı deneme_tablo olsun

create table deneme_tablo of xmltype;

bir kayıt insert edelim

insert into deneme_tablo values(
	xmltype('<kisi adi="muhammed" soyadi="yürürdurmaz" />')
)
insert into deneme_tablo values(
	xmltype('<kisi adi="ismail" soyadi="çakır" />')
)

şimdi tüm kayıtları listeleyelim

select * from deneme_tablo

şimdi ismi muhammed olan kayıtları sorgulayalım

select * from deneme_tablo tb
where (tb.OBJECT_VALUE, '/kisi[@adi=''muhammed'']') = 1

şimdi kişi adlarını listeleyelim olan kayıtları sorgulayalım

select (tb.OBJECT_VALUE, '/kisi/@adi') from deneme_tablo tb
Bookmark and Share
Tags: , , , ,
7
Mar

sql between operatörü

   Posted by: Muhammed YÜRÜRDURMAZ Tags: , , ,

select * from tablo where sayi  1 and 5

kullanırken between operatörünbe dikkat edin. bazı veritabanlarında 1 dahil olmazken bazılarında 5 dahil olmuyor. bazırlarında 1 ve 5 dahil olurken bazılarında 1 ve 5 dahil olmuyor

örnek olarak üzerinde 1 ve 5 dahil oluyor

Bookmark and Share
Tags: , , ,
27
Feb

SqlTools Linux üzerine kurma

   Posted by: İsmail ÇAKIR Tags: , , , , ,

Öncelikle indiriyoruz.

sistemimizde kuruluysa direkt olarak tıklayıp kurabiliriz.
wine yoksa
sudo apt-get install wine
ile kuruyoruz.
a ihtiyaç duyucaz, instantclient-basic-win32-11.1.0.7.0.zip. basic versiyonu indiriyoruz. Tabi benim veritabanım türkçe encoding de eğer ingilizce ise veritabanınız daha ufak olan basic-lite paketini indirebilirsiniz.
ev dizinimizdeki
.wine/drive_c/Program Files/SQLTools 1.42/ dizinine gidip instantclient-basic-win32-11.1.0.7.0.zip dosyasını buraya açıyoruz.
instantclient_11_1 dizinine açıcaktır. içindekileri üst dizine taşıyın.

daha sonra wine Sqltools.exe komutuyla ya da ana menudeki wine grubundan SQLtools u çalıştırabilirsiniz.

Bookmark and Share
Tags: , , , , ,

start

komutu ile dbconsole başlatmaya çalıştığınızda

/usr/bin/diff: /etc/: No such file or directory TZ set to
Etc/GMT+12 Enterprise Manager 10g Database Control Release

hatası alıyorsanız, sisteminizin ayarını yapmamışınızdır demektir.

ln -sf /usr/share/zoneinfo/Turkey /etc/localtime

komutu ile oluşturacağınız linkle bu sorunu aşabilirsiniz.

eğer

does not match the current environment TZ setting

hatası görüyorsanız, db ile sistem timezone farklıdır.

ORACLE_HOME dizinine geçip

emctl resetTZ agent

komutu vererek bu sorunu da aşabilirsiniz.

Bookmark and Share
Tags: , , , , , ,

Hani böylesine zorla yapmak istemeyizde mecbur kalınca, niye olmasın :)
stop
komutuyla durmuyorsa.
#!/bin/

for ind in `ps -aef | grep | grep -v grep | cut -f4 -d ' '`
do
kill -9 $ind
echo "process $ind"
done
if [ $? -eq 0 ]; then
lsnrctl start
fi
exit

Bookmark and Share
Tags: , , , , ,

Switch to our mobile site