oracle8.1.6 Select service from jb_services where active_check_p = 't' declare id integer; begin id := jb_screen.new( im_screen_name => :user_screen_name, service => :service, status => 'offline', refcount => '1', object_type => 'jb_screen' ); end; Select screen_id from jb_screens where im_screen_name = :user_screen_name and service = :service update jb_screens SET refcount = refcount + 1 where screen_id = :screen_id insert into jb_friends (user_id, friend_screen_id, friend_first_name, friend_last_name) values (:user_id, :screen_id, :first_names, :last_name) Select screen_id from jb_screens where im_screen_name = :user_screen_name and service = :service