取最大值
select greatest('3', '5') from dual
如何才能優化oracle的內存占用情況呢?為了開發的方便,想減少oracle平時占用的內存。下面就為您介紹一個通過調整oracle內存參數實現減少內存占用的方法,供您參考學習。
解決方法:
sqlplus “/ as sysdba"
create pfile='d:/cj.ora' from spfile;
然后去你的oracle安裝目錄
找一個init數據庫名.ora這樣一個文件
把幾個oracle內存參數改小點
一個2G的內存是如下配置的:
*.sga_max_size=712M
*.large_pool_size=8M
*.shared_pool_size=250M
*.sort_area_size=0.5M
*.db_cache_size=350M
然后shutdown數據庫
shutdown immediate;
create spfile from pfile='d:/cj2.ora';
startup;
然后啟動,就可以了。
以上就是調整oracle內存參數,減少數據庫內存占用的方法介紹。
oracle中的select語句可以用START WITH...CONNECT BY PRIOR子句實現遞歸查詢,connect by 是結構化查詢中用到的,其基本語法是:
Java代碼
select * from tablename start with cond1 connect by cond2 where cond3;
簡單說來是將一個樹狀結構存儲在一張表里,比如一個表中存在兩個字段:
id,parentid那么通過表示每一條記錄的parent是誰,就可以形成一個樹狀結構。
用上述語法的查詢可以取得這棵樹的所有記錄。
UIBarButtonItem *backButton = [[[UIBarButtonItem alloc] initWithTitle:@"my back button" style:UIBarButtonItemStyleBordered target:nil action:nil] autorelease];
self.navigationItem.leftBarButtonItem = backButton;
Iphone默認返回按鈕的文字是前一個view的title,
如果需要修改默認的返回名稱,需要在前一個頁面的viewDidLoad事件中進行設置:
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;@interface SettingViewController : UIViewController {
BOOL isPushedView;
}
@property (nonatomic, readwrite) BOOL isPushedView;
5. 在SettingViewController.m文件中添加具體實現代碼,如下:
@implementation SettingViewController @synthesize isPushedView; - (void)viewDidLoad { [super viewDidLoad]; if(isPushedView == NO) { self.navigationItem.title = @"設置"; self.navigationController.navigationBar.barStyle = UIBarStyleBlack; self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"完成" style:UIBarButtonItemStylePlain target:self action:@selector(cancel_Clicked:)] autorelease]; } } -(void) cancel_Clicked:(id)sender { [self.navigationController dismissModalViewControllerAnimated:YES]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); }
@class SettingViewController;
@interface RootViewController : UITableViewController {
SettingViewController *settingViewController;
UINavigationController *settingNavController;
}
7. 在RootViewController.m文件中添加實現代碼,如下:
- (void) settingClicked {
if(settingViewController == nil) {
settingViewController = [[SettingViewController alloc] initWithNibName:@"SettingView" bundle:[NSBundle mainBundle]];
settingViewController.isPushedView = NO;
}
if(settingNavController == nil) {
settingNavController = [[UINavigationController alloc] initWithRootViewController:settingViewController];
[self.navigationController presentModalViewController:settingNavController animated:YES];
}
}
8. DONE!!!
@class NewOrderViewController;
@interface RootViewController : UITableViewController {
NewOrderViewController *newOrderViewController;
}
@property (nonatomic, retain) NewOrderViewController *newOrderViewController;
5. 在RootViewController.m文件中實現跳轉,代碼如下:
//添加按鈕
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @"訂單列表";
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
UIBarButtonItem *buttonEdit = [[[UIBarButtonItem alloc] initWithTitle:@"編輯" style:UIBarButtonItemStyleBordered target:self action:@selector(editCharacters)] autorelease];
UIBarButtonItem *buttonAdd = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(showNewOrderView)] autorelease];
self.navigationItem.leftBarButtonItem=buttonEdit;
self.navigationItem.rightBarButtonItem=buttonAdd;
}
//實現跳轉
- (void) showNewOrderView {
if (self.newOrderViewController == nil) {
NewOrderViewController *newOrder = [[NewOrderViewController alloc] initWithNibName:@"NewOrderView" bundle:nil];
self.newOrderViewController = newOrder;
[newOrder release];
}
[self.navigationController pushViewController:self.newOrderViewController animated:YES];
}
In some of the iPhone's default apps, you may find that you can "edit" a table, then have little red minus signs appear to the left of the table, giving you the option to delete those rows. So, how do you do that in your own programs?
The answers, it turns out, is a very simple one:
[self.tableView setEditing:YES animated:YES];
That's literally all you need to do to set up those deletion marks. Then you just need to respond to tableView:commitEditingStyle: forRowAtIndexPath:.
However, there are some nuances, particularly the questions of how you start up a table's editing and how you end it, and I'm going to show some real-world examples of those methods over the course of this article ...
The program that I've showed off elsewhere in this series makes uses of a tableView's editing functionality by allowing the user to delete characters from the app, each of whom are represented by a table row
First, you need to set up some way to activate the functionality:
- (void)editCharacters {
[self.tableView setEditing:YES animated:YES];
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self
action:@selector(endTableEditing)];
self.navigationItem.leftBarButtonItem = doneButton;
[doneButton release];self.navigationItem.rightBarButtonItem = nil;
}
This method is triggered when a user selects an "Edit" button. You'll note that besides starting the editing, I also change around the button in my navbar. That's because when a user is editing I no longer need an "Edit" button, but instead require a "Done" button. You might alternatively set buttons' enabled properties to NO ... but in any case, you always need to give users a way to get out of editing mode.
Your tableView: method will probably delete the table item from your table and/or the data store that it originates from:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
[self recordWasDeleted:indexPath.row];
}
}
For completeness state, I'll also include the method call generated when the "Done" button is clicked:
- (void)endTableEditing {
[self.tableView setEditing:NO animated:YES];
[self updateButtons];
}
This is pretty much the opposite of my editCharacters method: the editing is turned back off, then the buttons are returned to their original state.
And that's really all you need to do to edit a table: turn editing on, respond to the deletion message, and turn it back off at the end.
You do have some other editing possibilities that I'm not going to cover in depth in this article. Most notably, you can adjust the editingStyle property of any individual cell. Apple claims it's set to UITableViewCellEditingStyleNone by default, but it sure looks to me like it's set to UITableViewCellEditingStyleDelete, which is what shows those handsome red minus marks. If you instead want to insert rows, you can set it to UITableViewCellEditingStyleInsert, and then do the appropriate thing when tableView:commitEditingStyle:forRowAtIndexPath: receives input of type insert.
That's it for me and tables for the nonce. If there's any other topics that you'd like covered regarding them, let me know in the comments. In the meantime, I'm planning to next return to my splashView topic, as some folks have requested in comments.