Archive for: 𔃶月 2012’

gitエラー ‘heroku’ does not appear to be a git repository

2012年6月27日 Posted by PURGE

よく理解せずにheroku と gitを使用していると、表題のエラーとなてしまった。どうやらお手本通りにやって、heroku というレポジトリで操作していたらしいが、git remote add するようだ。

C:\works\Hoge>heroku info
=== hoge
Addons:        Shared Database 5MB
Database Size: (empty)
Git URL:       git@heroku.com:hoge.git
Owner Email:   hoge@xxxx.jp
Repo Size:     8M
Slug Size:     10M
Stack:         cedar
Web URL:       http://hoge.herokuapp.com/

C:\works\Hoge>git push heroku master
fatal: 'heroku' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

C:\works\Hoge>git remote add hoge git@heroku.com:hoge.git

C:\works\Hoge>git push hoge master
Counting objects: 208, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (178/178), done.
Writing objects: 100% (190/190), 34.40 KiB, done.
Total 190 (delta 56), reused 0 (delta 0)

後でちゃんとgitコマンドについては理解しておこうと思う。

gitリモートレポジトリからソースの取得

2012年6月27日 Posted by PURGE

herokuを使い始めた。
別のノートPCで、herokuにリモートレポジトリから取得する方法の覚書。ちなみに、ノートPC環境はWindowsXP。

結構調べるのに時間が掛かったが、Subversion の checkoutコマンドのようなもの。リモートリポジトリからローカルに初めてソースを取り出す為に使用する。

git clone git@heroku.com:heroku-test.git HerokuTest

git clone リポジトリURL 作成フォルダ

gitの事始め

2012年6月27日 Posted by PURGE

gitでローカルにリポジトリを作成するという事始めのコマンド。

git init
git add .
git commit -m "Init"

CASE文のUPDATE

2012年6月26日 Posted by PURGE

今まで特に意識的には使用していなかったCASE文

UPDATE TARGET_TBL
SET COL1 = 
(CASE COL2
  WHEN 201103 then 201203
  WHEN 201102 then 201202
  ELSE 201201
 END
);

PL/SQLランダム値の生成

2012年6月13日 Posted by PURGE

set serveroutput on
DECLARE

  CURSOR ids is   
    select customer_id 
      from customer_mst;

  customers ids%ROWTYPE;
  rnd NUMBER(2);
BEGIN
  open corp2_ids;
    LOOP
      FETCH ids INTO customers;
        --50~95の整数ランダム値を返す
        rnd := trunc(DBMS_RANDOM.VALUE(50,95), 0);
        DBMS_OUTPUT.PUT_LINE(rnd);
      update customer_mst
         set score = rnd
       where customer_id = customers.customer_id;

      EXIT WHEN ids%NOTFOUND;
    END LOOP;
  commit;
  close ids;
END;
/

初めてのPL/SQL

2012年6月13日 Posted by PURGE

set serveroutput on
DECLARE
  CURSOR customer_ids is
  select customer_id
    from customer_mst
   where customer_id in
         (select customer_id
            from customers
           where customer_id in
                 (select customer_id
                    from customer_lst
                   where customer_id = 126 ));
 
  customers customer_ids%ROWTYPE;
BEGIN
  open customer_ids;
    LOOP
      FETCH customer_ids INTO customers;
 
        DBMS_OUTPUT.PUT_LINE(customers.customer_id);
 
      update customer_mst
         set exists_flg = 1
       where customer_id = customers.customer_id;
 
      EXIT WHEN customer_ids%NOTFOUND;
    END LOOP;
  commit;
  close customer_ids;
 
END;
/