oracle11g

Using SQL or PL/SQL to replace empty lines before start of content in CLOB

帅比萌擦擦* 提交于 2019-12-11 19:59:27
问题 If i have a clob field that contains the following text Note - The @ character denotes an empty line (with or without spaces). @ @ AB DF SDF DFDS F FDSFSDF @ DFSFDSFSDF @ DSFDS @ FDSF DSFS DF @ @ @ @ How can i modify it so that all the empty lines at the beginning of the text are removed (i.e. all empty lines up to the first line where there is content) I know there are several functions that Oracle provide for replacing strings but i am struggling to use any of them when i can ignore the

Find the Max and related fields

ぃ、小莉子 提交于 2019-12-11 19:46:23
问题 Here is my (simplified) problem, very common I guess: create table sample (client, recordDate, amount) I want to find out the latest recording, for each client, with recordDate and amount. I made the below code, which works, but I wonder if there is any better pattern or Oracle tweaks to improve the efficiency of such SELECT. (I am not allowed to modify to the structure of the database, so indexes etc are out of reach for me, and out of scope for the question). select client, recordDate,

how to insert Arabic text to oracle database?

爷,独闯天下 提交于 2019-12-11 19:36:13
问题 I have html + php application connected to oracle database 11g. I am trying to insert Arabic characters via form, The issue it shows "????" I surfed the internet to find a solution, and I did almost every trick but nothing works until now!! please I am disparate for help! My environment: Windows 7 home premium html charset is set to utf8 ( I tried windows-1256, windows-1252 also did not work) registry NLS_LANG is set to AMERICAN_AMERICA.AR8MSWIN1256 oracle 11g the table columns are set to

Issue in creating oracle function

*爱你&永不变心* 提交于 2019-12-11 19:32:31
问题 I have created a function which need input as month(11) and year(2018) and it will return the first Sunday of the next month. Create or replace function get_effectivedate (par_Month in int,Par_Year in int); Return date Is startDate varchar; edate date; begin startDate := par_Month+Par_Year; edate := select next_day(add_months(trunc(startDate, 'MM'), 1), 'Sunday') as EffectiveDate from dual; return edate; end; This function is prompting me while running and it is throwing some errors on

Oracle SQL - Alternative to the UNION ALL statement

随声附和 提交于 2019-12-11 19:32:25
问题 Given the follownig query that uses a union, Select col1,col2,col3,col4,col5,cast(multiset(temp.col1 from table(cast(xslt.children as clob_nt)) temp, col6 from tableA union all Select a,b,c,d,e,cast(multiset(temp.col1 from table(cast(tableB.children as clob_nt)) temp, col7 from tableB i would expect to get the following output (i.e. rows from both tables) tableA.x tableA.x tableA.x tableA.x tableA.x tableA.clob(x) tableA.x tableA.x tableA.x tableA.x tableA.x tableA.x tableA.clob(x) tableA.x

Oracle convert Date to Number

╄→尐↘猪︶ㄣ 提交于 2019-12-11 19:31:58
问题 I want to convert date to number in oracle 11g . The date is stored in (12/03/2013 12:23:00). I want to convert this to Number(The date corresponding number value). As in java we convert date to long . I want the same to be done here . Calendar c = Calendar.getInstance(); c.set(2013, 05, 23, 0, 0, 0); Date date = c.getTime(); System.out.println("Date is " + date); long longDate = date.getTime(); System.out.println("Date as long :" + longDate); Date d = new Date(longDate); System.out.println(

Passing variable user,pass,sid in sqlplus comman

两盒软妹~` 提交于 2019-12-11 19:26:37
问题 I want to pass variables in sqlplus command in my bash script, answer might be given but doesn't work for me. I tried some thing like this #!/bin/bash ssh oracle@10.116.12.26 <<XX echo Please enter an Oracle Username: read USERNAME echo "Please enter the Oracle Username's Password:" read -s PASS SID=XE export conn_str=$USERNAME/$PASS@$SID sqlplus $conn_str << EOF select * FROM tabs; exit EOF XX also tried sqlplus $USERNAME/$PASS@SID #with option -s and -l I also find solution like this but

Oracle equivalent of INSERT IGNORE

风流意气都作罢 提交于 2019-12-11 19:01:28
问题 I found a very similar topic on Oracle Equivalent to MySQL INSERT IGNORE? However, I could not make work any of the proposed solutions. My case is a little special as my table does contains only 1 field, which is the primary key. Let's call the field "id" and the table "myTable" in the following. Using MERGE merge into myTable t1 from ( select 42 as the_pk_value, 'TEST' as some_column from dual ) t2 on (t1.id = t2.the_pk_value) when not matched then insert (id) values (t2.the_pk_value); This

Oracle: Script similar to describe command

二次信任 提交于 2019-12-11 18:56:06
问题 I'm being asked to create a script that basically does the same thing as the describe command. I have figured out how to write the script and get the output I want, but the second part of the assignment is to "duplicate the format of the describe command" I'm stumped, is there really a way to simply duplicate that format? 回答1: Assuming your query is something like (note that I'm not bothering to handle every different data type) select column_name "Name", (case when nullable = 'N' then 'NOT

Learning Bind Variables in PL/SQL along with Calculation Input and Output DBMS_OUTPUT.PUT_LINE

旧城冷巷雨未停 提交于 2019-12-11 18:44:33
问题 I am performing a very simple PL/SQL program for school. It is pretty easy but I think I am missing a concept. I will show what I've been working on and not just ask for an easy answer. I would like to understand the concept of the DBMS_OUTPUT.PUT_LINE along with BIND variables that I have declared to calculate the volume of a rectangular prism, or a pool to say. I just don't have it declared back properly to the user. I am having trouble finding the correct information on OUTPUT to the user,