我需要连接一个表中的3列,并用分号分隔。经过研究,我决定使用xmlagg和getclobval()-直到本周初它开始抛出ORA-1489时,它都运行良好-字符串连接的结果太长了。我使用xmlagg和getclobval()来专门避免这种情况。目前,我仍在尝试查找有问题的行,但是希望有人确保我的代码正确无误。谢谢!
select id,
rtrim(extract(xmlagg(xmlelement(e, col1 || '; ' || col2 || '; ' || col3 || '; ')),
'/E/text()').getclobval(), chr(13)) AS concat_field from schema.table group by id
答案 0 :(得分:0)
如果col1 + col2 + col3 + separators的长度> 4000,则串联引发错误。 // class variable will hold the currently loaded song
private Song mCurrentSong;
[...]
viewHolder.playB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// MediaPlayer has not been initialized OR clicked song is not the currently loaded song
if (mCurrentSong == null || song != mCurrentSong) {
// Sets the currently loaded song
mCurrentSong = song;
mediaPlayer = MediaPlayer.create(context, song.getSong());
Toast.makeText(context, "Playing" + song.getName(),
Toast.LENGTH_LONG).show();
}
if (mediaPlayer.isPlaying()) {
mediaPlayer.pause();
viewHolder.playB.setImageResource(R.drawable.play);
} else {
mediaPlayer.start();
viewHolder.playB.setImageResource(R.drawable.pause);
}
}
});
viewHolder.stopB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// If currently loaded song is set the MediaPlayer must be initialized
if (mCurrentSong != null) {
mediaPlayer.stop();
mediaPlayer.release();
mCurrentSong = null; // Set back currently loaded song
}
viewHolder.playB.setImageResource(R.drawable.play);
}
});
解决方案:col1 || '; ' || col2 || '; ' || col3 || '; '
to_clob