我想从oracle中选择时格式化电话号码栏

时间:2019-05-31 04:11:55

标签: sql oracle

我试图在从电话号码栏中获取数据时加+1。示例数据(1234567890)

.flip-card, .one,.two,.three,.four,.five,.six {
    background-color: transparent;
    width: 280px;
    height: 275px;
    /*border: 1px solid #f1f1f1;*/
    perspective: 1000px; 

  
}


  .flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
  }
  
  /* Do a horizontal flip when you move the mouse over the flip box container*/ 
  .flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
  }
  
  /* Position the front and back side */
  .flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
  }
  
  /* Style the front side (fallback if image is missing)*/ 
  .flip-card-front, .t3,.t5 {
    background-color:green;
    color: black;
   background-position: top 15px;
  
  }
  
   .flip-card-front.t2 ,.t4,.t6 {
    background-color: rgb(248, 122, 4);
    color: black;
  
  
  }
  
  /* Style the back side */
  .flip-card-back {
    background-color: dodgerblue;
    color: white;
    transform: rotateY(180deg);
  }
  /*@media screen and (max-width:959px){
  }

/*END FLIP*/
.projects{
    background-color: blueviolet;
    width:100%;
height:680px;
display:block;}


.row{
    justify-content:space-between;
    display:block;
    

    
}

2 个答案:

答案 0 :(得分:2)

使用concat()||运算符

select concat('+1',phone_number) as phoneNumber from table1

OR

如果phone_number列的数据类型为number / int,则可以使用

select concat('+1',TO_CHAR(phone_number)) as phoneNumber from table1

答案 1 :(得分:0)

如果原始数据的长度固定为10,则可以考虑使用lpad,其padded_length为12,pad_string为+1

select lpad(phone_number,12,'+1') from table1