Skip to main content

Posts

Showing posts with the label exception handling

Function to check key validation using asp.net

Function to check key validation using asp. net ublic Function KeyValid(ByVal keyChar As Char, ByVal strType As KeyType) As Boolean Dim blnRetVal As Boolean Dim strNumStr As String = "0123456789" Dim strDecStr As String = "0123456789." Dim strAlpha As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" Dim strDate As String = "0123456789/" Dim strPhone As String = "0123456789-()," Dim strTime As String = "01234567890:" Dim strEqn As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./*+-()|" Dim strAlphaNum As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" Try blnRetVal = False If Asc(keyChar) < 32 Then KeyValid = False Exit Function End If Select Case strType Case KeyType.KeyAlpha If strAlpha.IndexOf(keyChar) < 0 Then blnRetVal = Not blnRetVal Case KeyType.KeyAlphaNum If strAlphaNum.IndexOf(keyChar) &

Code to send email using PLSQL

Code to send email using PLSQL You can use UTL_SMTP and UTL_TCP to send email attachment from Oracle Version 8i onwards. Sample Code: DECLARE v_From VARCHAR2(80) := 'oracle@mycompany.com'; v_Recipient VARCHAR2(80) := 'test@mycompany.com'; v_Subject VARCHAR2(80) := 'test subject'; v_Mail_Host VARCHAR2(30) := 'mail.mycompany.com'; v_Mail_Conn utl_smtp.Connection; crlf VARCHAR2(2) := chr(13)||chr(10); BEGIN v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 25); utl_smtp.Helo(v_Mail_Conn, v_Mail_Host); utl_smtp.Mail(v_Mail_Conn, v_From); utl_smtp.Rcpt(v_Mail_Conn, v_Recipient); utl_smtp.Data(v_Mail_Conn, 'Date: ' || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf || 'From: ' || v_From || crlf || 'Subject: '|| v_Subject || crlf || 'To: ' || v_Recipient || crlf || 'MIME-Version: 1.0'|| crlf || -- Use MIME mail standard 'Content-Type: multi