👤
Home Man
Search
Today's Posts
Register

All Windows and DOS questions should go here as well. Discuss UNIX to Windows (Desktop or Server) here!

Need help in select statetment

👤 Login to reply

 
Thread Tools Search this Thread
# 1  
Old 07-18-2012
Need help in select statetment

Dear Expert,

I have an table name (SMS) in which two column are there one "Flag" other is "Message", If my flag column consist of status "1" then output should be "welcome", else" try again" ,. please correct my code.

Code:
DECLARE 
c PLS_INTEGER := dbms_sql.open_cursor; 
flag VARCHAR2(50); 
STATEMENT VARCHAR2(255); 
BEGIN 
SELECT SUBSTR(flag, 1,2) 
INTO flag 
FROM xxx.sms; 
IF flag = 1 THEN 
dbms_output.put_line('welcome');
ELSE
dbms_output.put_line('ty again');
END IF;
END ;

Thank you,
# 2  
Old 07-20-2012
Code:
set serveroutput on size 100000
DECLARE 

flag VARCHAR2(50); 
STATEMENT VARCHAR2(255); 

BEGIN 
  dbms_output.enable(100000);
 SELECT SUBSTR(flag, 1,2) 
   INTO flag 
 FROM xxx.sms; 
 IF flag = 1 THEN 
   dbms_output.put_line('welcome');
 ELSE
   dbms_output.put_line('try again');
 END IF;
END ;

Try that.
👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
select unique bang_dba Shell Programming and Scripting 4 11-07-2011 01:20 AM
Socket and select naresh046 Programming 3 07-01-2011 02:54 PM
Reboot and Select Proper Boot device or insert Boot media in select Boot device and press a key rpf Boot Loaders 0 03-22-2011 03:20 PM
Select everything before a pattern usha rao Shell Programming and Scripting 15 05-19-2009 03:25 PM
Select Script dellroxy Shell Programming and Scripting 4 04-19-2009 05:05 AM
select a particular field Satyak Shell Programming and Scripting 4 10-09-2008 04:38 AM
mmap and select Hitori UNIX for Advanced & Expert Users 1 09-03-2008 12:12 PM
Need Help (Select query) topgear1000cc Shell Programming and Scripting 5 02-12-2008 06:22 AM
select vs poll smanu IP Networking 12 04-30-2007 05:22 PM
Select ALL in VI Editor rakish UNIX for Dummies Questions & Answers 22 08-14-2006 05:51 AM


All times are GMT -4. The time now is 09:17 PM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password





Not a Forum Member?
Forgot Password?