ÓÃSHELLµÄÑ»·ÅúÁ¿Ö´ÐÐSQLÓï¾ä
--kshϵÄÒ»¸öWHILE Ñ»·µÄÀý×Ó
integer i=1
while ((i<67))
do
pirnt $i
i=i+1
done
--ksh ÏÂÒ»¸öFORÑ»·µÄÀý×Ó
for i in `cat listdate.txt`
do
echo "Ö´ÐÐ $i "
done
--- date.pl ÓÃÓÚÉú³ÉÒ»¸öʱ¼ä¶ÎÎļþ
#!/usr/local/bin/perl
use DBI;
if($#ARGV<1)
{
die "USAGE:date.pl <startdate> <enddate> \n";
return(0);
}
$rundate1=$ARGV[0];
$rundate2=$ARGV[1];
$dbh=DBI->connect('dbi:Oracle:host=192.xx.xx.2;sid=ora7','report/system','')||
die('cann\'t connect to database');
$date=$dbh->prepare("select cal_date from calendar where cal_date between to_date(?,'yyyymmdd') and to_date(?,'yyyymmdd')");
$date->bind_param( 1, $rundate1);
$date->bind_param( 2, $rundate2);
$date->execute;
while (@row = $date->fetchrow_array)
{
printf("$row[0]\n");
}
$dbh->disconnect;
---ʵÀý Åú´¦ÀíÖ´ÐÐÒ»¶Îʱ¼ä ÿÌì ÒªÖ´ÐеijÌÐò
date.pl 20100101 20100307 > listdate.txt
for i in `cat listdate.txt`
do
echo "Ö´ÐÐ $i "
sqlplus cust/cust @cust_get_jf_md2010.sql $i
done
Ïà¹ØÎĵµ£º
SQL ÖеĴ洢¹ý³Ì£º
1.ÔÚ½¨Á¢´æ´¢¹ý³Ì֮ǰ¼ì²éËùÃüÃûµÄ´æ´¢¹ý³ÌÊÇ·ñÓ¦¾´æÔÚ¡££¨ÒòΪÈç¹ûͬÃû´æ´¢¹ý³ÌÒѾ´æÔÚ£¬ÐµĴ洢¹ý³Ì½«²»±»½¨Á¢£©
if exists(select * from sysobject where name='proc name' and type='p')
drop proc proc name
go
2.¶¨Òå´æ´¢¹ý³Ì
create proc test
@gradel int, --¶¨Òå±äÁ ......
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.Hibernat ......
Óöµ½MS SQL Server 2005 ÎÞ·¨É¾³ýÊý¾Ý¿â×÷Òµ¡£
¡¡¡¡Ê×ÏÈ£¬ÒÔsaÕË»§µÇ¼£¬²é¿´ÒÔÏÂ2¸ö±íµÄÊý¾Ý£¬Èç¹û²»Îª¿Õ¾ÍÓÐÎÊÌâ¡£
¡¡¡¡Sql´úÂë
¡¡¡¡select¡¡*¡¡from¡¡msdb.dbo.sysmaintplan_subplans
¡¡¡¡select¡¡*¡¡from¡¡msdb.dbo.sysmaintplan_log
¡¡¡¡Èç¹û²»Îª¿Õ£¬Ö´ÐÐÒÔϲÙ×÷£¬»ù±¾Éϲ»Óÿ¼ÂÇɾ³ýÄÄÒ»Ìõ¼Ç¼£¬ÓÐÎÊÌâµÄ×÷Òµ¾Í ......
select convert(numeric(10,4),iinvnowcost) from ...
decimal ºÍ numeric (À´Ô´sql Áª»ú´ÔÊé)
´ø¶¨µã¾«¶ÈºÍСÊýλÊýµÄ numeric Êý¾ÝÀàÐÍ¡£
decimal[(p[, s])] ºÍ numeric[(p[, s])]
¶¨µã¾«¶ÈºÍСÊýλÊý¡£Ê¹ÓÃ×î´ó¾«¶Èʱ£¬ÓÐЧֵ´Ó - 10^38 +1 µ½ 10^38 - 1¡£decimal µÄ SQL-92 ͬÒå´ÊÊÇ dec ºÍ dec(p, s)¡£
p£¨¾«¶È£© ......