Skip to main content

Posts

Showing posts with the label varchar2

Auto Increment of column which is varchar type in sql

Set Auto Increment of column which is varchar type in sql If you want to Set Auto Increment of column which is varchar type in sql table then you can do that by using following way CREATE TABLE StudentTable ( Regid int IDENTITY(1,1) NOT NULL , StudentCol nvarchar(3) DEFAULT 'STD' , StudentId AS (StudentCol+ REPLICATE('0', 10-LEN(CONVERT(nvarchar(100),Regid )) ,OtherColumnsYouNeed nvarchar(MAX) )

Maximum parameters in a procedure in PERL

#!/usr/bin/perl open(FOO,">c:/prod_test.sql"); $create = "Create or replace procedure "; $body = "\nbegin\n null;\n"; $statement = $create."foo("; for ($x=0;$x<8188;$x++){ $statement .= "a$x in varchar2,\n "; } $statement .= "done in varchar2)\n as"; print FOO $statement.$body."end;"; close FOO; at 8187 parameters it compiled. at 8188 it gave a program to large error. its  tested body length by adding "null;" to the body 10,000 times and it didn't mind. One other thing is the 2499 character limit per line.