| Author |
Message |
cyber_hecker |
| Location: Ponti Hot City |
|
Post subject: Ask: Deklarasi Variabel Pada MySQL ?
Posted: 07/Aug/2005 00:37
|
|
onProfessional

Joined: 19-May-2005
Posts: 981
Location: Ponti Hot City
Status: Offline
|
|
alo para senior-senior yang baik hati @[muji dulu, karena ada maunya] kekekeke
gue baru belajar mySQL neh, jadi masih awam dan sama sekali buta tentang mySQL. jadi gue mo nanya :
gimana cara mendeklarasikan variabel pada mySQL ?
kalo di ms SQL Server kan ada perintah
DECLARE @VARIABEL TYPE
SET @VARIABEL = 'DATA'
nah kalo di mySQL gimana ? |
_________________
|
| |
|
|
|
 |
imunk |
| Location: |
|
Post subject:
Posted: 04/Dec/2005 11:01
|
|
onUber-Skilled

Joined: 28-Mar-2005
Posts: 451
Status: Offline
|
|
| deklarasi disini buat apa?? deklarasi dari tabel yg sdh ada atau yg baru..?? |
|
|
| |
|
|
|
 |
cyber_hecker |
| Location: Ponti Hot City |
|
Post subject:
Posted: 04/Dec/2005 17:05
|
|
onProfessional

Joined: 19-May-2005
Posts: 981
Location: Ponti Hot City
Status: Offline
|
|
deklarasi variabel yang bisa digunakan di parameter query. contoh kita bikin query yang menggunakan parameter yang sama tapi untuk banyak query yang berbeda :
SELECT * FROM TrJual WHERE Tanggal < '2005-01-01'
UNION
SELECT * FROM TrRetur WHERE Tanggal < '2005-01-01'
dst.. dst..
daripada boros kan lebih baik pake variable contoh :
SET @TANGGAL = '2005-01-01'
SELECT * FROM TrJual WHERE Tanggal < @TANGGAL
UNION
SELECT * FROM TrRetur WHERE Tanggal < @TANGGAL
|
_________________
|
| |
|
|
|
 |
|
LuriDarmawan |
| Location: here |
|
Post subject:
Posted: 05/Dec/2005 07:09
|
|
onApaAdanya

Joined: 15-Mar-2005
Posts: 1617
Location: here
|
|
|
|
|
 |
imunk |
| Location: |
|
Post subject:
Posted: 05/Dec/2005 14:18
|
|
onUber-Skilled

Joined: 28-Mar-2005
Posts: 451
Status: Offline
|
|
@luridarmawan
Quote:
SET @TANGGAL = '2005-01-01'
SELECT * FROM TrJual WHERE Tanggal < @TANGGAL
UNION
SELECT * FROM TrRetur WHERE Tanggal < @TANGGAL
error mas.....
saya coba tambahkan titik koma spt berikut
Quote:
SET @TANGGAL = '2005-01-01';
SELECT * FROM TrJual WHERE Tanggal < @TANGGAL
UNION
SELECT * FROM TrRetur WHERE Tanggal < @TANGGAL
result is empty....
padahal di database sudah ada mas, kalo salah syntax salahnya dimana ya...???
oh iya mas luri user dan password masuk ke "gudang.delphi-id.org"
apa ya, aku pake user=pubftpd dan password=pubftpd.
ko gak bisa masuk..... |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: 05/Dec/2005 15:43
|
|
onProfessional

Joined: 06-Aug-2005
Posts: 648
|
|
| Waleh..waleh..udah tua banget akangku yg satu ini....user pubftpd paswword pubpub.....wakaakakakakakakaak baru umur 23 taon aja udah lupanya segitu pasti diajak kang cy ber guling2an trus ya....wakakaakakakaka |
_________________ == Barudak Jambi ===
Company : http://www.mpiholding.com/
|
| |
|
|
|
 |
|
LuriDarmawan |
| Location: here |
|
Post subject:
Posted: 05/Dec/2005 20:12
|
|
onApaAdanya

Joined: 15-Mar-2005
Posts: 1617
Location: here
|
|
|
|
|
 |
cyber_hecker |
| Location: Ponti Hot City |
|
Post subject:
Posted: 06/Dec/2005 00:29
|
|
onProfessional

Joined: 19-May-2005
Posts: 981
Location: Ponti Hot City
Status: Offline
|
|
OOT: woloh.. adminnya pelit neh.. mosok gambarnya kecil kayak gitu.. kekekeke.... takut program bajakannya ketahuan pow |
_________________
|
| |
|
|
|
 |
|
LuriDarmawan |
| Location: here |
|
Post subject:
Posted: 06/Dec/2005 06:08
|
|
onApaAdanya

Joined: 15-Mar-2005
Posts: 1617
Location: here
|
|
|
|
|
 |
imunk |
| Location: |
|
Post subject:
Posted: 07/Dec/2005 09:58
|
|
onUber-Skilled

Joined: 28-Mar-2005
Posts: 451
Status: Offline
|
|
kucoba lagi ternyata tetep gak jalan mas luri.
aku pake mysql 4.1.2, mas luri pake mysql veris berapa??
terus tipe data di tabelku adalah "date" mas, kalo mas luri kayaknya "datetime" deh tipenya...  |
|
|
| |
|
|
|
 |
|
LuriDarmawan |
| Location: here |
|
Post subject:
Posted: 07/Dec/2005 13:19
|
|
onApaAdanya

Joined: 15-Mar-2005
Posts: 1617
Location: here
|
|
|
|
|
 |
|
kaka-delphi |
| Location: Taziex |
|
Post subject:
Posted: 07/Dec/2005 22:55
|
|
onElite
Joined: 12-Oct-2005
Posts: 1050
Location: Taziex
|
|
Ketawa mas ulil lucu xixiixixixixiixixi ...............
Apa MySQL versi 4.0.xx udah bisa support kayak gituan ? maksud gituan tuch kayak deklarasi variable, store proc, transaction ........
Mohon info nya jugha  |
|
|
| |
|
|
|
 |
|
LuriDarmawan |
| Location: here |
|
Post subject:
Posted: 08/Dec/2005 03:43
|
|
onApaAdanya

Joined: 15-Mar-2005
Posts: 1617
Location: here
|
|
|
|
|
 |
|
donald |
| Location: Tongas - Probolinggo |
|
Post subject:
Posted: 01/Jul/2007 13:38
|
|
onSkilled

Joined: 08-Jun-2007
Posts: 114
Location: Tongas - Probolinggo
|
|
kang luri kalo buat varibel pada mysql 5 caranya sama?
terus saya pengen tanya tentang storeprocedure dan triger nih pada mysql 5, hehehhehehheheheh
maklum kang masih cupu |
_________________ Apa yang di pikirkan itu adalah do'a
Apa yang di ucapkan itu adalah do'a
Pikirkan dan ucapkan yang baik-baik
|
| |
|
|
|
 |
mbahdien |
| Location: Semarang |
|
Post subject:
Posted: 06/Oct/2009 16:20
|
|
onIntermediate
Joined: 16-Apr-2007
Posts: 54
Location: Semarang
Status: Offline
|
|
Lama nggak ketemu nih, tampilan delphi-id beda. Mo ikut nimbrung aja, nih aku kasih contoh stored procedure:
Quote:
CREATE PROCEDURE `sp_postedkaskecil`(IN tanggal DATE, IN nogudang INTEGER)
NOT DETERMINISTIC
SQL SECURITY DEFINER
COMMENT ''
begin
declare fidcompany,fidgudang,fidcoadebet,fidcoacredit,fidcashbookmin int;
declare fdebet,fcredit double(15,0);
declare ckaskeciljurnal cursor for
select idcompany,idgudang,idcash_book_min,debet,credit,idcoa_debet,idcoa_credit from
cash_book_min where idgudang=nogudang and
tgl=tanggal and is_posted=1;
declare exit handler for not found begin end;
open ckaskeciljurnal;
loop
fetch ckaskeciljurnal into fidcompany,
fidgudang,fidcashbookmin,fdebet,fcredit,fidcoadebet,fidcoacredit;
begin
declare fkodecompany varchar(125);
declare fidjurnal,fidjurnalno,nocompany int;
declare fjurnalno varchar(255);
select idcompany into nocompany from gudang where
idgudang=nogudang;
select kode into fkodecompany from
master_company where idcompany=nocompany;
select concat('JU','-',fkodecompany,'-',lpad(
ifnull(max(idjurnal_no),0)+1,7,'0000000'),'-',date_format(tanggal,'%y')),
ifnull(max(idjurnal_no),0)+1
into FJurnalno,fidjurnalno from coa_jurnal where ti=year(tanggal) and idcompany=nocompany;
select ifnull(max(idcoa_jurnal),0)+1 into fidjurnal from coa_jurnal;
insert into coa_jurnal(idcoa_jurnal,
tgl,idjurnal_no,ti,
idcompany,jurnal_no) values(
fidjurnal,tanggal,fidjurnalno,
year(tanggal),
nocompany,fjurnalno);
begin
insert into coa_jurnal_det(idcoa_jurnal,idcompany,idcoa,
debet,credit,iddokumen,idjns) values(fidjurnal,
fidcompany,
fidcoadebet,fdebet,0,fidcashbookmin,11);
insert into coa_jurnal_det(idcoa_jurnal,idcompany,idcoa,
debet,credit,iddokumen,idjns) values(fidjurnal,
fidcompany,
fidcoacredit,0,fcredit,fidcashbookmin,11);
end;
end;
end loop;
end;
Puyeng bacanya ya? Saya sendiri yang buat ikut puyeng.
Itu adalah contoh stored procedure yang ada looping cursornya. Moga bisa dipelajari. |
_________________ Rumah saya dari Mrican belok kanan.
Kontak:(024)70332916, 08157761318
http://delphirewo.blogspot.com
|
| |
|
|
|
 |
|
|