sql - Insert in Oracle table if rows size is under 300 -



sql - Insert in Oracle table if rows size is under 300 -

i have table in want have maximum 300 rows of data:

create table "admin"."sessions" ( "sessionid" varchar2(30 byte), "sessiontype" number(*,0), "userid" varchar2(30 byte), "activitystart" timestamp (6), "activityend" timestamp (6), "activity" clob, "username" varchar2(30 byte), "ipaddress" varchar2(30 byte), "logintime" timestamp (6), "logouttime" timestamp (6) ) segment creation immediate

can tell me how can insert table if maximum number not reached? want using prepared statement.

i close question duplicate of creating table max number of rows (oracle). basically, it's impossible , if need you're doing wrong. don't want calculating number of records in table prior inserting - lot of excess work.

however, given names of column names in table there's easier way of doing this. alter sessions parameter 300. restrict database 300 concurrent sessions. if effort made create 301st session error ora-00018 maximum number of sessions exceeded raised. if restricting number of concurrent users may have relatively aggressive dropping unused connections - depends on number of users you're expecting.

if still need maintain table after can utilize before logon , before logoff triggers maintain (though i'm not sure activityend , logouttime used for), before login trigger insert table , before logoff delete it.

sql oracle oracle11g

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -