Posts

oracle - How to categorize several columns in one statement in SQL/PLSQL -

i've got table 20 columns categorize like; 0-25 --> 1 25-50 --> 2 50-75 --> 3 75-100 --> 4 i prefer not use 20 case ... when statements. knows how more dynamically & efficiently? can sql or pl/sql. i tried pl/sql, didn't see simple method use column names variables. many thanks. frans your example bit confusing, assuming want put value categories, function width_bucket might after: something this: with sample_data ( select trunc(dbms_random.value(1,100)) val dual connect level < 10 ) select val, width_bucket(val, 0, 100, 4) category sample_data; this assign numbers 1-4 (random) values sample_data. 0, 100 defines range build buckets, , final parameter 4 says in how many (equally wide) buckets should distributed. result of function bucket value val fall. sqlfiddle example: http://sqlfiddle.com/#!4/d41d8/10721

destroy - How do I delete all div with an id that begins with xyz with dojo 1.8.3? -

i want delete <div> id begins xyz dom tree. i know can done dojo.query , dojo.destroy never used combination before. i tried doesn't work: var divnodeswidgets = dijit.findwidgets('[id^="divnodes"]'); dojo.foreach(divnodeswidgets, function(d) { d.destroyrecursive(true); }); var ulwidgets = dijit.findwidgets('[id^="ulnodes"]'); dojo.foreach(ulwidgets, function(u) { u.destroyrecursive(true); }); var headingwidgets = dijit.findwidgets('[id^="h1nodes"]'); dojo.foreach(headingwidgets, function(h) { h.destroyrecursive(true); is destroying widget or element, if element try with: dojo.foreach(dojo.query('[id^="xyz"]'), function(entry,idx){ dojo.destroy(entry); alert(entry + " destroyed"); }); or dojo.query('[id^="xyz"]').foreach(dojo.destroy);

How to add 1 day to current date and have result in format yyyymmdd in SQL Server? -

i need add 1 day current date , have output in format yyyymmdd. code needs written on stored procedure on sql server. currently code follows: declare @dat date select @dat = dateadd(dd, 1, getdate()) select @dat =left(convert(varchar(8), @dat, 112),10) however, seems im doing wrong output on sql table in format yyyy-mm-dd. need rid of hyphens. any suggestions guys? in advance. the issue assigning date object. need assign varchar. i did following in sql server 2005: declare @dat datetime declare @string varchar(8) set @dat = getutcdate() select @dat = dateadd(dd, 1, getdate()) select @string =convert(varchar(8), @dat, 112) print @string

Using bootstrap-datetime picker with AngularJS -

my project needs datetime found (meridian format in) bootstrap-datetimepicker seems pretty good, not able use it all did in code <div class="control-group"> <label class="control-label">date</label> <div class="controls"> <div class="control-group input-append date form_datetime" data-date="2012-12-21t15:25:00z"> <input size="16" type="text" ng-model="transaction.date" data-date-format="yyyy-mm-dd hh:ii" value=""> <span class="add-on"><em class="icon-remove"></em></span> <span class="add-on"><em class="icon-th"></em></span> </div> </div> </div> but when console.log($scope.transaction) in controller $scope.save = function() { var transaction = new transaction(); transaction....

rest - OAuth access token for internal calls -

i'm tyring build api driven symfony2 web applicaiton.just basic application learn symfony2 , rest. it based on restful api. calls api authenticated using oauth. for e.g.: if client application wants data (information fruits) through api need make request url , pass access token parameter.so url this. http://www.mysite.com/api/fruits.json?=<access token> now problem needing same data in 1 of actions well. i need here.in order get data above url in 1 of actions need send access token in url. how access token?? should there fixed token used such calls within application?? you basic application project grow manifold if try want here. basically, need implement authentication server this. i) first, app should registered scope; ii) using app user logs in authentication/authorization server. iii) server verifies if app has access scope , if user registered in system. iv) server creates access token (which hmac signed string) , returns app. v) app hits...

sql - calculation shows NaN error -

in visual studio report have sum of 2 textboxes when calculated shows 'nan'. reason because calculation projects 0. simple calculation textbox 1 / textbox 2. is there way can code show 0.00 or show blank instead of nan when type of project selected drop down parameters? i cannot have seperate report different prioject types linked same overall totals. any advice appreciated. change formula iif statement evaluate 2 textboxes. need make sure both numeric , divisor not zero. if of true, set value 0.00 else calculation.

sql update - Updating Multiple Columns from another table - Need Oracle format -

i have script use in sql server need convert oracle format. can help? update persons p set p.jobtitle=te.jobtitle, p.last_name=te.last_name, p.first_name=te.first_name, p.dblogin_id=te.dblogin_id, p.email_id=te.email_id, p.userlevel=te.userlevel, p.facility_id=te.facility_id, p.supervisor=te.supervisor, p.department=te.department, p.winloginid=te.winloginid temp_ecolab_persons te p.person=te.person; --from article below came following statement. still doesn't work unfortunately: update (select p.jobtitle, p.last_name, p.first_name, p.dblogin_id, p.email_id, p.userlevel, p.facility_id, p.supervisor, p.department, te.jobtitle, te.last_name, te.first_name, te.dblogin_id, te.email_id, te.userlevel, te.facility_id, te.supervisor, te.department persons p, temp_ecolab_persons te p.person=te.person) set p.jobtitle=te.jobtitle, p.last_name=te.last_...