0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

DBから必要なデータを取得する

Posted at

DBからデータを取得するときにエラーを生じない方法

    public Hospital__c getHospitalById(String id){
        list<Hospital__c> lists =[select id,Hospital_Code__c,Hospital_name__c from Hospital__c where id=:id limit 1];

        if(lists.size() >0){
            return lists[0];
        }
        return new Hospital__c();
    }

条件にふさわしいデータない場合は空の配列を返す

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?