Aku kasih conto sederhana yach ...
SQL> create table abc1(a varchar2(15));
Table created.
SQL> alter table abc1
2 add constraint ck_abc1_a CHECK (substr(a,1,2) = 'AB');
Table altered.
SQL> insert into abc1 values('AB123');
1 row created.
SQL> insert into abc1 values('AC123');
insert into abc1 values('AC123')
*
ERROR at line 1:
ORA-02290: check constraint (SCOTT.CK_ABC1_A) violated
Bowo
--- In [email protected], Reka Sukamto <[EMAIL PROTECTED]>
wrote:
> thx to mas bowo,
>
> bisa dijelaskan lebih detail?utk penggunaan CHECK constrainya?
>
> RekA
>
> Yulius Wibowo <[EMAIL PROTECTED]> wrote:
>
> Gunakan CHECK constraint
> atau
> pakai trigger
>
> Bowo
>
> --- In [email protected], Reka Sukamto
<[EMAIL PROTECTED]>
> wrote:
> >
> > Dear all, mohon bantuanya...
> >
> > Misalnya ada 1 table:
> > Pegawai , dgn field : nama varchar2(100)
> > nip varchar2(30)
> > alamat varchar2(300)
> >
> > saya mau buat constraint di filed nip, tp yg saya inginkan
> berdasarkan 10 karakter terakhir saja.
> > jadi constraintnya berdasar substr(nip,21,10).bisa ga ya?
> >
> > thx ya
> >
> > RekA
> >
> >
> >
> >
> >
> > ---------------------------------
> > Celebrate Yahoo!'s 10th Birthday!
> > Yahoo! Netrospective: 100 Moments of the Web
> >
> > [Non-text portions of this message have been removed]
>
>
>
>
>
> --
> -----------I.N.D.O - O.R.A.C.L.E---------------
> Keluar: [EMAIL PROTECTED]
> Website: http://indo-oracle.blogspot.com
> -----------------------------------------------
>
> Bergabung dengan Indonesia Thin Client User Groups,
> Terminal Server, Citrix, New Moon Caneveral, di:
> http://indo-thin.vze.com
>
>
> Yahoo! Groups SponsorADVERTISEMENT
>
>
> ---------------------------------
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/indo-oracle/
>
> To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
>
>
>
> ---------------------------------
> Celebrate Yahoo!'s 10th Birthday!
> Yahoo! Netrospective: 100 Moments of the Web
>
> [Non-text portions of this message have been removed]
--
-----------I.N.D.O - O.R.A.C.L.E---------------
Keluar: [EMAIL PROTECTED]
Website: http://indo-oracle.blogspot.com
-----------------------------------------------
Bergabung dengan Indonesia Thin Client User Groups,
Terminal Server, Citrix, New Moon Caneveral, di:
http://indo-thin.vze.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/indo-oracle/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/