You can store an IP as a number, that is how they exist internally, but you will have to write code to convert back and forth:
#include <arpa/inet.h>
/*
* Returns a pointer to an internal array containing the string, which is overwritten with each call to the function.
* You need to copy the string if you want to keep the value returned.
*/
extern char *inet_ntoa (struct in_addr in);
/*
* Convert Internet host address from numbers-and-dots notation in CP
* into binary data and store the result in the structure inp.
*/
extern int inet_aton (const char *cp, struct in_addr *inp);
Here is some simple SQL that does what one of these do ip->decimal , using 127.0.0.1
SELECT
TO_NUMBER(REGEXP_SUBSTR('127.0.0.1','\w+',1,1))*POWER(2,24)
+ TO_NUMBER(REGEXP_SUBSTR('127.0.0.1','\w+',1,2))*POWER(2,16)
+ TO_NUMBER(REGEXP_SUBSTR('127.0.0.1','\w+',1,3))*POWER(2,8)
+ TO_NUMBER(REGEXP_SUBSTR('127.0.0.1','\w+',1,4))*POWER(2,0) IP
FROM
DUAL;