Jump to content

Pl/sql Topulu Konchem Randi Babu... Oo Sahayam Kavali


Recommended Posts

Posted

[quote name='Jeedeelu' timestamp='1356030277' post='1302988632']
ya..thelusu ba... nadhi ms sql.. difference chepthuna...
[/quote]
got u CITI#H@ CITI#H@

  • Replies 88
  • Created
  • Last Reply

Top Posters In This Topic

  • Kakateyudu

    35

  • cherlapalli_jailer

    18

  • Mrlavangam

    10

  • ChampakDas

    8

Top Posters In This Topic

Posted

[quote name='Kakateeyudu©' timestamp='1356030313' post='1302988642']
got u CITI#H@ CITI#H@
[/quote]
Agreed calling champak das..

Posted

[quote name='Jeedeelu' timestamp='1356029966' post='1302988586']
ante pl/sql elagaina rasukovachu...

nuvu paina rasindhi... ms sql cheyalemu...
[/quote]
ms/sql lo syntax different anthe we can do it ms sql too

decleare @kaka int

selecr kaka=count(*) from afdb

Posted

[quote name='cherlapalli_jailer' timestamp='1356031582' post='1302988858']
ms/sql lo syntax different anthe we can do it ms sql too

decleare @kaka int

selecr kaka=count(*) from afdb
[/quote]
declare chesa baa aa variable paina....

Posted

[quote name='cherlapalli_jailer' timestamp='1356031582' post='1302988858']
ms/sql lo syntax different anthe we can do it ms sql too

decleare @kaka int

selecr kaka=count(*) from afdb
[/quote]
ya thelusu ba... declare seyyali manam variable ni... kani ala paina direct ga rayalem antunna..

Posted

[quote name='Kakateeyudu©' timestamp='1356029207' post='1302988477']

status k ani cheppa kada..... count(*) lo 0 vunte status 'k' vellali aa table lo ki or lekapohe 'x' vellali baa
[/quote]


correct me if i am wrong

update afdb set status = k (here u can write case stmt later) where
0 = ( slect count(*) from afdb where field1 = "kakteeyudu")

else


update afdb set status = X (here u can write case stmt later) where
0 not in ( slect count(*) from afdb where field1 = "kakteeyudu")

is this what u r looking?

Posted

[quote name='cherlapalli_jailer' timestamp='1356031812' post='1302988908']


correct me if i am wrong

update afdb set status = k (here u can write case stmt later) where
0 = ( slect count(*) from afdb where field1 = "kakteeyudu")

else


update afdb set status = X (here u can write case stmt later) where
0 not in ( slect count(*) from afdb where field1 = "kakteeyudu")

is this what u r looking?
[/quote]


update kaadhu mama na trigger only inserts data to an other table.. insert chese appudu correct status tho vellipovali....

becasue depending on the status aa vere table nunchi vere trigger trigger avtadi.....

Posted

[quote name='Kakateeyudu©' timestamp='1356031948' post='1302988937']


update kaadhu mama na trigger only inserts data to an other table.. insert chese appudu correct status tho vellipovali....

becasue depending on the status aa vere table nunchi vere trigger trigger avtadi.....
[/quote]


Try this

BEGIN
v_status char
SELECT count(*) INTO v_count
FROM afdb;

if v_count > 0
v_status:='K'
else
v_status:='X'

INSERT INTO New_tbl
(X,X,X,X )
VALUES
( :new.X,
:new.X,
:new.X,
:new.X,
v_status );

END;

Posted

CREATE OR REPLACE TRIGGER afdb_after_insert
AFTER INSERT
ON orders
FOR EACH ROW

Posted

[quote name='cherlapalli_jailer' timestamp='1356032235' post='1302988986']


Try this

BEGIN
v_status char
SELECT count(*) INTO v_count
FROM afdb;

if v_count > 0
v_status:='K'
else
v_status:='X'

INSERT INTO New_tbl
(X,X,X,X )
VALUES
( :new.X,
:new.X,
:new.X,
:new.X,
v_status );

END;
[/quote]

mama paina rasina select count(*) nuvvu diff ga ardam cheskunnav baa

na requirement yendhi ante v_count ane variable lo ki aa table lo ni oka field lo 'n' ane status yenni vunnai oo kavali

Posted

[quote name='cherlapalli_jailer' timestamp='1356032325' post='1302989009']
CREATE OR REPLACE TRIGGER afdb_after_insert
AFTER INSERT
ON orders
FOR EACH ROW
[/quote]
trigger motham vundhi baa paina mention chesina condition satisfy cheyyali

Posted

[quote name='Kakateeyudu©' timestamp='1356032440' post='1302989033']

mama paina rasina select count(*) nuvvu diff ga ardam cheskunnav baa

na requirement yendhi ante v_count ane variable lo ki aa table lo ni oka field lo 'n' ane status yenni vunnai oo kavali
[/quote]
nee requiment PM cheyyi kasta confusing ga vunnadi

coz

is this the stmt u r looking?


SELECT count(*) INTO v_count
FROM afdb where :OLD:filed1=:NEW.field1 and status = 'K'

if v_count > 0
v_status:='K'
else
v_status:='X'

INSERT INTO New_tbl
(X,X,X,X )
VALUES
( :new.X,
:new.X,
:new.X,
:new.X,
v_status );

END;

;

Posted

Table1 ane table lo status,key1 ane fields vunnai anukundam....

so na condition endhi ante kakateyudu ane variable lo ki table1 lo key1 lo same value and status='n' ane rows yenni vunnai ani

table:

key1 status

1 n
1 n
1 x

paina table ki naku aa kakateyudu ane variable lo ki 2 ravali

×
×
  • Create New...