Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

David Davis rsswire.info

« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS 

create and call an oracle function

create or replace function "ORACLE_FOO"
(foo_arg1 in NUMBER)
return NUMBER
is
rt NUMBER := 0;
begin
  IF foo_arg1 > 1 THEN
    SELECT 1 INTO rt;
  ELSE
    SELECT 2 INTO rt;
  END IF;
  RETURN (rt);
end;

SELECT ORACLE_FOO(1) FROM dual;

Simple Ajax

http = getHTTPObject();

function getHTTPObject(){
var xmlhttp;

/*@cc_on

@if (@_jscript_version >= 5)
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(E){
xmlhttp = false;
}
}
@else
xmlhttp = false;
@end @*/

if(!xmlhttp && typeof XMLHttpRequest != 'undefined'){
try {
xmlhttp = new XMLHttpRequest();
}catch(e){
xmlhttp = false;
}
}

return xmlhttp;
}

function doMath(){
var url = "backend.php?op=" + document.getElementById('op').value;
url += "&num1=" + document.getElementById('num1').value;
url += "&num2=" + document.getElementById('num2').value;

http.open("GET", url, true);
http.onreadystatechange = handleHttpResponse;

http.send(null);
}

function handleHttpResponse(){
if(http.readyState == 4){
document.getElementById('answer').innerHTML = http.responseText;
}
}

Detect a field edit in Excel and refresh a Query

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim wks As Worksheet
    Set wks = ActiveSheet

    If Target.Row = 1 And Target.Column = 1 Then
      wks.QueryTables(1).Refresh
    End If

    Set wks = Nothing
End Sub
« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS