oracle数据库中,number类型的数据如何转换为integer类型的数据

有A,B两张表,A表的一个字段是integer类型的,B表的一个字段是number类型的,(没有小数),现在需要将B表这一字段全部插入A表的字段中,但发现转换不过去,并且很奇怪的是,数据库报的错误是,不能将char类型的数据转化为int类型,这是怎么回事?

4个回答

oracle数据库的number是针对所有的数字的,如果你提示那个错误的话,select 出来以后就是字符的,所以你需要转一下to_nuber()。

select id,to_number(count), name from student where 1=

P923284735
小菜鸟阿庆 是to_number
2 年多之前 回复

to_number()转换一下

convert()转换一下试试

数据库有integer类型么?所有数字类型不都是number类型

qq_38005982
我本狂儒 好吧!我孤陋寡闻了,我只知道char和number,还有int
2 年多之前 回复
m0_38093650
啊喵是我 integer是短整型
2 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
poi导入excel到数据库,数据库是number类型,实体是integer,解析过程中报错

![图片说明](https://img-ask.csdn.net/upload/201510/08/1444290580_466806.png) ![图片说明](https://img-ask.csdn.net/upload/201510/08/1444290660_809106.png)

oracle中number类型转换

to_char(min(a.l_entrust_time),'HH24:mm:ss') 其中a.l_entrust_time在数据库中为number类型,如:140930,想转为14:09:30应该怎么转换

数据库number类型java String类型可以接吗?

数据库number类型java String类型可以接吗? 数据库number类型java String类型可以接吗? 数据库number类型java String类型可以接吗?

Mybatis查询Oracle数据库结果为null,但数据库中存在该条记录

最近学习mybatis时遇到问题,相关配置应该是正确的,用mysql查询也能返回结果,但是将数据源切换到Oracle时总是返回null,求教。mybatis查询日志如下: ``` Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter. PooledDataSource forcefully closed/removed all connections. PooledDataSource forcefully closed/removed all connections. PooledDataSource forcefully closed/removed all connections. PooledDataSource forcefully closed/removed all connections. Created connection 174573182. Returned connection 174573182 to pool. Opening JDBC Connection Checked out connection 174573182 from pool. Setting autocommit to false on JDBC Connection [oracle.jdbc.driver.T4CConnection@a67c67e] ==> Preparing: SELECT ID id, LAST_NAME lastName, GENDER gender, EMAIL email FROM mybatis_employee WHERE ID = ? ==> Parameters: 1(Integer) <== Total: 0 null Resetting autocommit to true on JDBC Connection [oracle.jdbc.driver.T4CConnection@a67c67e] Closing JDBC Connection [oracle.jdbc.driver.T4CConnection@a67c67e] Returned connection 174573182 to pool. ``` 但是,将mybatis发送的SQL复制到数据中直接查询也能查询到该记录。mybatis能返回null,可以说明Oracle数据库连接应该是没问题的,应该是结果的包装出了问题,相关代码描述如下文,求赐教。 Oracle中mybatis\_employee表定义如下: ```SQL ID INTEGER LAST\_NAME VARCHAR2(255) Y GENDER INTEGER Y EMAIL VARCHAR2(255) Y ``` mybatis对应的查询配置如下: ```xml <select id="getEmployeeById" resultType="cn.seu.edu.Mybatis.bean.Employee" databaseId="oracle"> SELECT ID id, LAST_NAME lastName, GENDER gender, EMAIL email FROM mybatis_employee WHERE ID = #{id} </select> ``` 测试代码如下: ```java public void testEmployeeMapper() throws IOException{ // 创建SqlSessionFactory对象 InputStream inputStream = Resources.getResourceAsStream("conf/mybatis-config.xml"); SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); // 创建session SqlSession sqlSession = sqlSessionFactory.openSession(); Assert.assertNotNull(sqlSession); try { // 获取接口的实现类对象 // Mybatis会为接口实现一个代理对象,由代理对象执行sql EmployeeMapper employeeMapper = sqlSession.getMapper(EmployeeMapper.class); // 调用接口的方法 Employee employee = employeeMapper.getEmployeeById(1); System.out.println(employee); } finally { sqlSession.close(); } } ``` Employee类定义如下 ```java private Integer id; private String lastName; private Integer gender; private String email; 以下省略setter和getter ```

Symfony2 Doctrine2 Oracle数据库NUMBER DEFAULT类型?

<div class="post-text" itemprop="text"> <p>I have a problem, I migrated an application from Symfony 1.4 to Symfony 2.4. I had some troubles getting a decimal variable working. I ended up updating the database with another type but now that I have to use the old production Oracle Database, Doctrine2 tells me I cannot update a field type if there is data in it.</p> <p>The data it stores is 0.1 or 0.5 or 1.0</p> <p>In Oracle, the DATA_TYPE is "NUMBER"</p> <pre><code> CREATE TABLE "APPRENTICE"."APPRENTICE_YEARTYPE" ( "ID" NUMBER(20,0), "NAME" VARCHAR2(255 BYTE), "ROUNDNUMBER" NUMBER DEFAULT NULL ) SEGMENT CREATION IMMEDIATE </code></pre> <p>When I export the old database with the Symfony2 command, the datatype in Doctrine is Integer... I cannot have decimals with an int. When I try to change the type to decimal with a scale of 2, I get the error that I cannot change the type.</p> <p>The generated Doctrine2 code :</p> <pre><code>/** * @var integer * * @ORM\Column(name="ROUNDNUMBER", type="integer", nullable=false) */ private $roundnumber; </code></pre> <p>The Doctrine1 schema : </p> <pre><code>ApprenticeYeartype: columns: id: {type: integer, notnull: true, primary: true, autoincrement: true} name: {type: string(255), notnull: true} roundNumber: {type: float, notnull: true} </code></pre> <p>If I try to set the Doctrine2 value to float and update, I get the following error :</p> <pre><code> [Doctrine\DBAL\DBALException] An exception occurred while executing 'ALTER TABLE APPRENTICE_YEARTYPE MODI FY (ROUNDNUMBER DOUBLE PRECISION DEFAULT NULL)': ORA-01440: column to be modified must be empty to decrease precision or sca le [Doctrine\DBAL\Driver\OCI8\OCI8Exception] ORA-01440: column to be modified must be empty to decrease precision or sca le </code></pre> <p>I'm stuck with this, anyone can help ?</p> <p>Regards </p> </div>

Oracle中table类型数据赋值给cursor

在Type中创建了一个类型: create or replace type bb_ptyxztqk_Table as table of bb_ptyxztqk_type; 里面放自定义的record类型,现在要将table中的数据放置到cursor中,怎么弄? 这样弄不行: open cur for select r_index, r_name, r_this, r_last, r_minus from table(cast(obj_type_tab AS bb_ptyxztqk_type)); 求大神指点! 整体代码: 类型: create or replace type bb_ptyxztqk_Table as table of bb_ptyxztqk_type; create or replace type bb_ptyxztqk_Type as object( d_index number, d_name varchar2(100), d_this number, d_last number, d_minus number ); sql: PROCEDURE pro_getdata(enddate in varchar2, cur out type_cursor) is Type RecType Is Record( r_index number, r_name varchar2(100), r_this number, r_last number, r_minus number); Type TabType Is Table Of RecType Index By Binary_Integer; myTab TabType; obj_type_tab bb_ptyxztqk_table := bb_ptyxztqk_table(); l_index number := 1; begin if (l_index = 1) then myTab(l_index).r_index := 1; myTab(l_index).r_name := '上线单位'; myTab(l_index).r_this := 123; myTab(l_index).r_last := 456; myTab(l_index).r_minus := 333; end if; l_index := myTab.First; for l_in in l_index .. myTab.count Loop obj_type_tab.EXTEND; obj_type_tab(obj_type_tab.LAST) := bb_ptyxztqk_type(myTab(l_index).r_index, myTab(l_index).r_name, myTab(l_index).r_this, myTab(l_index).r_last, myTab(l_index).r_minus); l_index := myTab.Next(l_index); end Loop; open cur for select r_index, r_name, r_this, r_last, r_minus from table(cast(obj_type_tab AS bb_ptyxztqk_type)); end;

oracle导入数据,varchar类型的数字会变成科学计数

我从本地导出一个库dmp,然后新建一个用户,再导入库,在同一表里面同一个字段, 有的数据是正确的,有的数据就编程科学计数了

java多线程高并发下的oracle数据库异常

代码的功能是生成一个随机的序列化的订单号,正常的情况下一个一个跑没问题,在进行压力测试的时候,多线程高并发下,oracle的create语句就会报错,说是 java.lang.RuntimeException: org.springframework.jdbc.BadSqlGrammarException: ConnectionCallback; bad SQL grammar []; nested exception is java.sqlSQLException: ORA-00955: 名称已由现有对象使用 求大神看下。 代码如下: ``` package utils.spring; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.dao.DataAccessException; import org.springframework.jdbc.core.ConnectionCallback; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.PreparedStatementCallback; import org.springframework.stereotype.Component; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.TransactionCallback; import org.springframework.transaction.support.TransactionTemplate; import utils.Lang; import javax.sql.DataSource; import java.sql.*; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * 序列发生器(可用于高并发、可回收等场景) * * @author lujijiang * */ @Component @ConfigurationProperties(prefix = "seqGenerator") final public class SequenceGenerator implements InitializingBean { interface Atom<T> { T atom(Connection connection) throws Exception; } public static <T> T atom(Connection connection, Atom<T> atom) throws Exception { connection.setAutoCommit(false); connection .setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); try { T obj = atom.atom(connection); connection.commit(); return obj; } catch (Exception e) { connection.rollback(); throw e; } } static Map<String, String> createSqlMap = new ConcurrentHashMap<String, String>(); static { createSqlMap .put("h2", "CREATE TABLE %s (v$key BIGINT NOT NULL,v$key$ varchar(256),v$seq BIGINT NOT NULL,v$state CHAR(1) NOT NULL, PRIMARY KEY (v$key,v$seq))"); createSqlMap .put("mysql", "CREATE TABLE %s (v$key BIGINT NOT NULL,v$key$ varchar(256),v$seq BIGINT NOT NULL,v$state CHAR(1) NOT NULL, PRIMARY KEY (v$key,v$seq))"); createSqlMap .put("informix", "CREATE TABLE %s (v$key DECIMAL(16,0) NOT NULL,v$key$ varchar(256),v$seq DECIMAL(16,0) NOT NULL,v$state CHAR(1) NOT NULL, PRIMARY KEY (v$key,v$seq))"); createSqlMap .put("oracle", "CREATE TABLE %s (v$key NUMBER(16,0) NOT NULL,v$key$ varchar2(256),v$seq NUMBER(16,0) NOT NULL,v$state CHAR(1) NOT NULL, PRIMARY KEY (v$key,v$seq))"); } static Map<String, String> insertSqlMap = new ConcurrentHashMap<String, String>(); static { insertSqlMap .put("h2", "insert into %s(v$key,v$key$,v$seq,v$state) values(%d,'%s',(select ifnull(max(t.v$seq),%d)+%d from %s t where t.v$key=%d),'1')"); insertSqlMap .put("mysql", "insert into %s(v$key,v$key$,v$seq,v$state) values(%d,'%s',(select ifnull(max(t.v$seq),%d)+%d from %s t where t.v$key=%d),'1')"); insertSqlMap .put("informix", "insert into %s(v$key,v$key$,v$seq,v$state) values(%d,'%s',(select nvl(max(t.v$seq),%d)+%d from %s t where t.v$key=%d),'1')"); insertSqlMap .put("oracle", "insert into %s(v$key,v$key$,v$seq,v$state) values(%d,'%s',(select nvl(max(t.v$seq),%d)+%d from %s t where t.v$key=%d),'1')"); } /** * 事务模版 */ TransactionTemplate transactionTemplate; /** * 是否使用新事务 */ boolean newTransaction = true; /** * JDBC模版 */ JdbcTemplate jdbcTemplate; /** * 尝试次数(默认10次) */ int tryTime = 10; /** * 数据库类型 */ String databaseType; /** * 表名 */ private String tableName; /** * 容量 */ private int capacity = 25; /** * 步进 */ private int step = 1; /** * 是否可回收序列号 */ protected boolean recyclable; @Autowired public void setTransactionManager( PlatformTransactionManager transactionManager) { if (transactionManager != null) { transactionTemplate = new TransactionTemplate(transactionManager); transactionTemplate .setIsolationLevel(TransactionTemplate.ISOLATION_READ_COMMITTED); transactionTemplate .setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRED); } } public boolean isNewTransaction() { return newTransaction; } public void setNewTransaction(boolean newTransaction) { this.newTransaction = newTransaction; } public TransactionTemplate getTransactionTemplate() { return transactionTemplate; } public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } @Autowired public void setDataSource(DataSource dataSource) { if (jdbcTemplate == null) { jdbcTemplate = new JdbcTemplate(dataSource); } } public void setTransactionTemplate(TransactionTemplate transactionTemplate) { this.transactionTemplate = transactionTemplate; } public void setTryTime(int tryTime) { this.tryTime = tryTime; } public void setDatabaseType(String databaseType) { if (databaseType != null) { databaseType = databaseType.trim().toLowerCase(); this.databaseType = databaseType; } } public void setTableName(String tableName) { this.tableName = tableName == null ? null : tableName.trim(); } public void setCapacity(int capacity) { this.capacity = capacity; } public void setStep(int step) { this.step = step < 1 ? 1 : step; } public void setRecyclable(boolean recyclable) { this.recyclable = recyclable; } /** * 创建序列 * * @param name * @param length * @param start * @return */ public String generateSequence(String name, int length, long start) { final long key = generateKey(name); try { return generateSequence(key, length, start, name); } catch (Throwable t) { createSequenceTable();//错误就是定位在这里 int time = tryTime >= 0 ? tryTime : 10000; while (time-- > 0) { try { return generateSequence(key, length, start, name); } catch (Throwable e) { } } throw new RuntimeException("Generate sequence failure", t); } } private long generateKey(String name) { return 10000000000L + name.trim().hashCode(); } /** * 创建序列 * * @param key * @param length * @return */ public String generateSequence(String key, int length) { return generateSequence(key, length, 0); } /** * 创建序列 * * @param key * @return */ public String generateSequence(String key) { return generateSequence(key, 6); } private synchronized void createSequenceTable() { try { jdbcTemplate.execute(new ConnectionCallback<Integer>() { public Integer doInConnection(Connection connection) throws SQLException, DataAccessException { ResultSet rs = connection.getMetaData().getTables(null, null, tableName, null); try { while (rs.next()) { return 1; } } finally { rs.close(); } String createSql = String.format( createSqlMap.get(databaseType), tableName); Statement statement = connection.createStatement(); try { statement.execute(createSql);//错误就是定位在这里 } finally { statement.close(); } return 0; } }); } catch (Throwable t) { throw new RuntimeException(t); } } private String generateSequence(final long key, final int length, final long start, final String name) { if (newTransaction) { try { Connection connection = jdbcTemplate.getDataSource() .getConnection(); try { return atom(connection, new Atom<String>() { @Override public String atom(Connection connection) throws Exception { if (recyclable) { String no = getRecoveredSequence(connection, key, length); if (no != null) { return no; } } Statement statement = connection.createStatement(); try { String insertSql = String.format(insertSqlMap .get(databaseType), tableName, key, name.replace("'", "''"), start < 0 ? 0 : start, step, tableName, key); execute(connection, insertSql); String querySql = String .format("select max(v$seq) from %s where v$key=%d and v$state='1'", tableName, key); ResultSet rs = statement.executeQuery(querySql); try { while (rs.next()) { Long max = rs.getLong(1); if (max < start) {// 重新初始化 String deleteSql = String .format("delete from %s where v$key=%d and v$state='1'", tableName, key); execute(connection, deleteSql); insertSql = String.format( insertSqlMap .get(databaseType), tableName, key, name.replace("'", "''"), start < 0 ? 0 : start, step, tableName, key); execute(connection, insertSql); return fillLeftZero(start, length); } if (capacity > 0 && max % capacity == 0) { String deleteSql = String .format("delete from %s where v$key=%d and v$seq<>%d and v$state='1'", tableName, key, max); execute(connection, deleteSql); } return fillLeftZero(max, length); } } finally { rs.close(); } } finally { statement.close(); } throw new IllegalStateException( SequenceGenerator.this.getClass() .getSimpleName() + "无法获取单号,不可能发生的异常"); } }); } finally { connection.close(); } } catch (Exception e) { throw Lang.unchecked(e); } } return getTransactionTemplate().execute( new TransactionCallback<String>() { public String doInTransaction(TransactionStatus ts) { try { if (recyclable) { String no = jdbcTemplate .execute(new ConnectionCallback<String>() { public String doInConnection( Connection connection) throws SQLException, DataAccessException { return getRecoveredSequence( connection, key, length); } }); if (no != null) { return no; } } String insertSql = String.format(insertSqlMap .get(databaseType), tableName, key, name .replace("'", "''"), start < 0 ? 0 : start, step, tableName, key); execute(insertSql); String querySql = String .format("select max(v$seq) from %s where v$key=%d and v$state='1'", tableName, key); Long max = jdbcTemplate.queryForObject(querySql, Long.class); if (max < start) {// 重新初始化 String deleteSql = String .format("delete from %s where v$key=%d and v$state='1'", tableName, key); execute(deleteSql); insertSql = String.format(insertSqlMap .get(databaseType), tableName, key, name.replace("'", "''"), start < 0 ? 0 : start, step, tableName, key); execute(insertSql); return fillLeftZero(start, length); } if (capacity > 0 && max % capacity == 0) { String deleteSql = String .format("delete from %s where v$key=%d and v$seq<>%d and v$state='1'", tableName, key, max); execute(deleteSql); } return fillLeftZero(max, length); } catch (Throwable t) { ts.isRollbackOnly(); throw new RuntimeException(t); } } }); } /** * 参数化执行SQL * * @param sql * @param args * @return */ protected int execute(String sql, final Object... args) { return jdbcTemplate.execute(sql, new PreparedStatementCallback<Integer>() { public Integer doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException { if (args != null) { for (int i = 0; i < args.length; i++) { ps.setObject(i + 1, args[i]); } } return ps.executeUpdate(); } }); } /** * 参数化执行SQL * * @param sql * @param args * @return * @throws SQLException */ protected int execute(Connection conn, String sql, final Object... args) throws SQLException { PreparedStatement ps = conn.prepareStatement(sql); try { if (args != null) { for (int i = 0; i < args.length; i++) { ps.setObject(i + 1, args[i]); } } return ps.executeUpdate(); } finally { ps.close(); } } protected String fillLeftZero(Long max, int length) { StringBuilder sb = new StringBuilder(); sb.append(max); if (sb.length() >= length) { return sb.substring(sb.length() - length); } else { for (int i = sb.length(); i < length; i++) { sb.insert(0, '0'); } } return sb.toString(); } /** * 获取已回收的序列 * * @param connection * @param key * @throws SQLException */ protected String getRecoveredSequence(Connection connection, long key, int length) throws SQLException { Statement statement = connection.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); try { String querySql = String .format("select v$key,v$seq,v$state from %s where v$key = %d and v$state<>'1' for update", tableName, key); statement.executeQuery(querySql); querySql = String .format("select v$key,v$seq,v$state from %s where v$key = %d and v$state<>'1' order by v$seq asc", tableName, key); ResultSet rs = statement.executeQuery(querySql); try { while (rs.next()) { try { Long min = rs.getLong(2); rs.updateString(3, "1"); rs.updateRow(); return fillLeftZero(min, length); } catch (Throwable ex) { } } } finally { rs.close(); } } finally { statement.close(); } return null; } /** * 回收序列号 * * @param name * @param sequence */ public void recoveredSequence(final String name, final String sequence) { final long key = generateKey(name); final long seq = Long.valueOf(sequence); if (newTransaction) { try { Connection connection = jdbcTemplate.getDataSource() .getConnection(); try { atom(connection, new Atom<Object>() { public Object atom(Connection connection) throws Exception { String updateSql = String .format("update %s set v$state='0' where v$key=%d and v$seq=%d", tableName, key, seq); int count = execute(connection, updateSql); if (count == 0) { String insertSql = String .format("insert into %s(v$key,v$key$,v$seq,v$state) values(%d,'%s',%d,'0')", tableName, key, name.replace("'", "''"), seq); execute(connection, insertSql); } return null; } }); connection.commit(); } finally { connection.close(); } } catch (Exception e) { throw Lang.unchecked(e); } } else { transactionTemplate.execute(new TransactionCallback<Integer>() { public Integer doInTransaction(TransactionStatus status) { try { String updateSql = String .format("update %s set v$state='0' where v$key=%d and v$seq=%d", tableName, key, seq); int count = execute(updateSql); if (count == 0) { String insertSql = String .format("insert into %s(v$key,v$key$,v$seq,v$state) values(%d,'%s',%d,'0')", tableName, key, name.replace("'", "''"), seq); execute(insertSql); } return null; } catch (Throwable t) { status.isRollbackOnly(); throw new RuntimeException(t); } } }); } } public void afterPropertiesSet() throws Exception { if (this.databaseType == null) { throw new IllegalArgumentException(String.format( "Property '%s' is required", "databaseType")); } if (databaseType != null) { if (!createSqlMap.containsKey(databaseType)) { throw new IllegalStateException(String.format( "Unsupported database type:%s", databaseType)); } } if (this.jdbcTemplate == null) { throw new IllegalArgumentException(String.format( "Property '%s' or '%s' is required", "dataSource", "jdbcTemplate")); } if (this.tableName == null) { throw new IllegalArgumentException(String.format( "Property '%s' is required", "tableName")); } if (!tableName.matches("[a-zA-Z_][a-zA-Z0-9_]*") || tableName.length() > 16) { throw new IllegalStateException(String.format( "Illegal tableName:%s", tableName)); } if (!this.newTransaction) { if (this.transactionTemplate == null) { throw new IllegalArgumentException(String.format( "Property '%s' is required", "transactionManager")); } } } } ``` java.lang.RuntimeException: org.springframework.jdbc.BadSqlGrammarException: ConnectionCallback; bad SQL grammar []; nested exception is java.sql.SQLException: ORA-00955: 名称已由现有对象使用 at utils.spring.SequenceGenerator.createSequenceTable(SequenceGenerator.java:272) at utils.spring.SequenceGenerator.generateSequence(SequenceGenerator.java:202) at utils.spring.SequenceGenerator.generateSequence(SequenceGenerator.java:227) at cart.service.service.OrderService.generateOrderNo(OrderService.java:806) at cart.service.service.OrderService.saveVirtualGoodsToOrder(OrderService.java:220) at cart.service.service.OrderService$$FastClassBySpringCGLIB$$19f99be7.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655) at cart.service.service.OrderService$$EnhancerBySpringCGLIB$$feb8eef.saveVirtualGoodsToOrder(<generated>) at cart.service.apiImpl.OrderMainApiImpl.saveVirtualGoodsToOrder(OrderMainApiImpl.java:223) at cart.service.apiImpl.OrderMainApiImpl$$FastClassBySpringCGLIB$$fa3518e.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:651) at cart.service.apiImpl.OrderMainApiImpl$$EnhancerBySpringCGLIB$$497f044.saveVirtualGoodsToOrder(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.weibo.api.motan.rpc.DefaultProvider.invoke(DefaultProvider.java:57) at com.weibo.api.motan.rpc.AbstractProvider.call(AbstractProvider.java:47) at com.weibo.api.motan.filter.AccessLogFilter.filter(AccessLogFilter.java:56) at com.weibo.api.motan.protocol.support.ProtocolFilterDecorator$2.call(ProtocolFilterDecorator.java:150) at utils.rpc.motan.filter.OpenEntityManagerInMotanFilter.filter(OpenEntityManagerInMotanFilter.java:171) at com.weibo.api.motan.protocol.support.ProtocolFilterDecorator$2.call(ProtocolFilterDecorator.java:150) at com.weibo.api.motan.transport.ProviderMessageRouter.call(ProviderMessageRouter.java:96) at com.weibo.api.motan.transport.ProviderProtectedMessageRouter.call(ProviderProtectedMessageRouter.java:79) at com.weibo.api.motan.transport.ProviderMessageRouter.handle(ProviderMessageRouter.java:91) at com.weibo.api.motan.transport.support.DefaultRpcHeartbeatFactory$HeartMessageHandleWrapper.handle(DefaultRpcHeartbeatFactory.java:82) at com.weibo.api.motan.transport.netty.NettyChannelHandler.processRequest(NettyChannelHandler.java:139) at com.weibo.api.motan.transport.netty.NettyChannelHandler.access$000(NettyChannelHandler.java:47) at com.weibo.api.motan.transport.netty.NettyChannelHandler$1.run(NettyChannelHandler.java:116) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.jdbc.BadSqlGrammarException: ConnectionCallback; bad SQL grammar []; nested exception is java.sql.SQLException: ORA-00955: 名称已由现有对象使用 at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:99) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:360) at utils.spring.SequenceGenerator.createSequenceTable(SequenceGenerator.java:247) ... 39 more Caused by: java.sql.SQLException: ORA-00955: 名称已由现有对象使用 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288) at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745) at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:210) at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:961) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1190) at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1726) at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1696) at utils.spring.SequenceGenerator$1.doInConnection(SequenceGenerator.java:264) at utils.spring.SequenceGenerator$1.doInConnection(SequenceGenerator.java:247) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:353) ... 40 more

mybatis-generator生成java类型问题请教

最近在用mybatis-generator通过数据库生成表格,感觉很方便,但有个问题解决不了。我用的是Oracle数据库,我的主键是Integer类型的。然后生成的Entity类的,主键类型是BigDecimal。在配置里面这个配置的是false。 <javaTypeResolver> <property name="forceBigDecimals" value="false"/> </javaTypeResolver> 官方的解释是 如果精度大于零,或长度大于18,java.math。将使用BigDecimal类型 如果精度是零,和长度是10到18之间,然后解析器将替代java.lang.Long的Java类型。 如果精度是零,和长度是5到9,那么Java类型解析器将替代java.lang.Integer。 如果精度是零,和长度小于5,那么Java类型解析器将替代java.lang.Short。 但我这个主键是Integer类型的,我是通过powerdesigner设计的,无法写长度。 就问,这个怎么转成Integer类型。是不是需要把powerdesigner设计成number精度怎么定义?还是其他什么。主键想用序列还没生成,对oracle不太熟悉

使用mybatis查询id返回的值为null 但是在数据库查询是有结果的

![图片说明](https://img-ask.csdn.net/upload/201702/07/1486440667_10512.png)

通过mybatis查询出来的结果中Integer类型出现了isDeleted=false

![图片说明](https://img-ask.csdn.net/upload/201603/09/1457507455_166522.png) 看图,真正的原因是什么?

oracle 存储过程 返回复合数据类型(index by表) ibatis如何接受

最近有个问题一直困扰着,希望各位能给予帮助。 先贴代码: 1 <parameterMap class="map" id="UserIndexParam"> 2 <parameter property="PRM_USERID" javaType="java.lang.Object" 3 jdbcType="Object" mode="IN" /> 4 <parameter property="PRM_OBJECTS" javaType="java.sql.ResultSet" 5 jdbcType="ARRAY" mode="OUT" typeHandler="com.diy.object.entity.ObjectTypeHandler" /> 6 <parameter property="PRM_TAGS" javaType="java.sql.ResultSet" 7 jdbcType="ARRAY" mode="OUT" typeHandler="com.diy.tag.entity.TagsTypeHandler" /> 8 <parameter property="PRM_APPCODE" javaType="java.lang.String" 9 jdbcType="VARCHAR" mode="OUT" /> 10 <parameter property="PRM_ERRMSG" javaType="java.lang.String" 11 jdbcType="VARCHAR" mode="OUT" /> 12 </parameterMap> 13 14 <procedure id="prc_user_index" parameterMap="UserIndexParam"> 15 {call 16 PKG_USER.PRC_USER_INDEXVIEW(?,?,?,?,?)} 17 </procedure> 这个ibatis的配置文件. 在网上查了很久,说是用typeHandler和jdbcType来解决解决oracle复合类型, 1 package com.diy.tag.entity; 2 3 import java.sql.CallableStatement; 4 import java.sql.PreparedStatement; 5 import java.sql.ResultSet; 6 import java.sql.SQLException; 7 import java.util.ArrayList; 8 import java.util.List; 9 10 import oracle.sql.Datum; 11 import oracle.sql.STRUCT; 12 13 import com.ibatis.sqlmap.engine.type.TypeHandler; 14 15 public class TagsTypeHandler implements TypeHandler { 16 17 /** 18 * @Description: 这个方法重点 19 * @param cs 20 * @param arg1 21 * @throws SQLException 22 */ 23 public java.lang.Object getResult(CallableStatement cs, int arg1) 24 throws SQLException { 25 List<Tag> list = new ArrayList<Tag>(); 26 ResultSet rs = cs.getArray(arg1).getResultSet(); 27 while (rs.next()) { 28 Datum[] data = ((STRUCT)rs.getObject(2)).getOracleAttributes(); 29 Tag tag = new Tag(); 30 if (data[0] != null) { 31 tag.setTagid(new Long(data[0].getBytes().toString())); 32 } 33 list.add(tag); 34 } 35 return list; 36 } 37 38 @Override 39 public boolean equals(java.lang.Object arg0, String arg1) { 40 // TODO Auto-generated method stub 41 return false; 42 } 43 44 @Override 45 public java.lang.Object getResult(ResultSet arg0, String arg1) 46 throws SQLException { 47 // TODO Auto-generated method stub 48 return null; 49 } 50 51 @Override 52 public java.lang.Object getResult(ResultSet arg0, int arg1) 53 throws SQLException { 54 // TODO Auto-generated method stub 55 return null; 56 } 57 58 59 60 @Override 61 public void setParameter(PreparedStatement arg0, int arg1, 62 java.lang.Object arg2, String arg3) throws SQLException { 63 // TODO Auto-generated method stub 64 65 } 66 67 @Override 68 public java.lang.Object valueOf(String arg0) { 69 // TODO Auto-generated method stub 70 return null; 71 } 72 73 } 这个是java代码,其中一个handler处理类 1 --定义 object表 对象 2 TYPE object_arr IS TABLE OF OBJECT%ROWTYPE INDEX BY BINARY_INTEGER; 3 4 --定义 tag index_by表 5 TYPE table_tag IS TABLE OF TAGS_INFO INDEX BY BINARY_INTEGER; 这个定义的oracle复合类型 1 PROCEDURE PRC_USER_INDEXVIEW(PRM_USERID IN VARCHAR2, 2 PRM_OBJECTS OUT PKG_COMM.OBJECT_ARR, 3 PRM_TAGS OUT PKG_COMM.table_tag, 4 PRM_APPCODE OUT VARCHAR2, 5 PRM_ERRMSG OUT VARCHAR2) IS 6 N_FLAG NUMBER; 7 VAR_FIRSTTAG VARCHAR2(100); 8 VAR_DUSERID VARCHAR2(100); 9 --用户兴趣标签 10 CURSOR CUR_USERTAG IS 11 SELECT C.TAGID, C.NAME 12 FROM USERSDETIAL A, TAGRELATION B, TAG C 13 WHERE A.DUSERSID = B.DUSERSID 14 AND B.TAGID = C.TAGID 15 AND A.DUSERSID = VAR_DUSERID; 16 --公共兴趣标签 17 CURSOR CUR_USERPUB IS 18 SELECT T.* 19 FROM (SELECT ROWNUM AS RNUM, 20 COUNT(A.DUSERSID) AS CNUM, 21 B.TAGID, 22 B.NAME 23 FROM TAGRELATION A, TAG B 24 WHERE A.TAGID = B.TAGID 25 GROUP BY A.TAGID) T 26 WHERE RNUM <= 8 27 ORDER BY T.CNUM DESC; 28 --object 29 CURSOR CUR_OBJ(VAR_TAGID VARCHAR2) IS 30 SELECT ROWNUM AS RN, A.* 31 FROM OBJECT A 32 WHERE trim(A.TAGID) = VAR_TAGID 33 AND ROWNUM < 30; 34 35 REC_USERTAG CUR_USERTAG%ROWTYPE; 36 REC_USERPUB CUR_USERPUB%ROWTYPE; 37 REC_OBJ OBJECT%ROWTYPE; 38 BEGIN 39 PRM_APPCODE := PKG_COMM.DEF_OK; 40 PRM_ERRMSG := ''; 41 42 IF PRM_USERID IS NULL THEN 43 PRM_APPCODE := PKG_COMM.DEF_ERR; 44 PRM_ERRMSG := '参数未定义'; 45 RETURN; 46 END IF; 47 --用户详细ID是否存在 48 SELECT B.DUSERSID 49 INTO VAR_DUSERID 50 FROM USERS A, USERSDETIAL B 51 WHERE A.USERID = B.USERSID 52 AND A.USERID = PRM_USERID; 53 IF VAR_DUSERID IS NULL THEN 54 PRM_APPCODE := PKG_COMM.DEF_ERR; 55 PRM_ERRMSG := '参数无效'; 56 RETURN; 57 END IF; 58 --1.判断是否为有效用户 59 SELECT NVL(A.FLAG, 1) 60 INTO N_FLAG 61 FROM USERS A, USERSDETIAL B 62 WHERE A.Userid = B.USERSID 63 AND B.DUSERSID = VAR_DUSERID; 64 65 IF N_FLAG = 1 THEN 66 PRM_APPCODE := PKG_COMM.DEF_ERR; 67 PRM_ERRMSG := '用户已被禁止登录'; 68 RETURN; 69 END IF; 70 71 --2.判断用户是否有兴趣tag 72 73 FOR REC_USERTAG IN CUR_USERTAG LOOP 74 75 IF CUR_USERTAG%ROWCOUNT = 0 THEN 76 --获取公共兴趣游标 77 FOR REC_USERPUB IN CUR_USERPUB LOOP 78 IF CUR_USERPUB%ROWCOUNT = 1 THEN 79 VAR_FIRSTTAG := REC_USERPUB.TAGID; 80 END IF; 81 PRM_TAGS(CUR_USERPUB%ROWCOUNT).TAGID := REC_USERPUB.TAGID; 82 PRM_TAGS(CUR_USERPUB%ROWCOUNT).TAGNAME := REC_USERPUB.NAME; 83 END LOOP; 84 ELSIF CUR_USERTAG%ROWCOUNT = 1 THEN 85 VAR_FIRSTTAG := REC_USERTAG.TAGID; 86 END IF; 87 PRM_TAGS(CUR_USERTAG%ROWCOUNT).TAGID := REC_USERTAG.TAGID; 88 PRM_TAGS(CUR_USERTAG%ROWCOUNT).TAGNAME := REC_USERTAG.NAME; 89 END LOOP; 90 91 IF PRM_TAGS.count <> 0 THEN 92 --3. 取出object 93 FOR REC_OBJ IN CUR_OBJ(VAR_FIRSTTAG) LOOP 94 PRM_OBJECTS(CUR_OBJ%ROWCOUNT).OWNERID := REC_OBJ.OWNERID; 95 PRM_OBJECTS(CUR_OBJ%ROWCOUNT).OBJECTID := REC_OBJ.OBJECTID; 96 PRM_OBJECTS(CUR_OBJ%ROWCOUNT).DBUSID := REC_OBJ.DBUSID; 97 PRM_OBJECTS(CUR_OBJ%ROWCOUNT).DUSERSID := REC_OBJ.DUSERSID; 98 PRM_OBJECTS(CUR_OBJ%ROWCOUNT).TAGID := REC_OBJ.TAGID; 99 PRM_OBJECTS(CUR_OBJ%ROWCOUNT).LOVENUM := REC_OBJ.LOVENUM; 100 PRM_OBJECTS(CUR_OBJ%ROWCOUNT).INRUDUCTION := REC_OBJ.INRUDUCTION; 101 PRM_OBJECTS(CUR_OBJ%ROWCOUNT).CATAGROY := REC_OBJ.CATAGROY; 102 PRM_OBJECTS(CUR_OBJ%ROWCOUNT).Imagepath := REC_OBJ.Imagepath; 103 104 END LOOP; 105 END IF; 106 107 EXCEPTION 108 WHEN OTHERS THEN 109 PRM_APPCODE := PKG_COMM.DEF_ERR; 110 PRM_ERRMSG := '获取主界面数据失败' || '错误原因:' || PRM_ERRMSG || '-' || SQLERRM || 111 '错误行数:' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE(); 112 END; 这个是存储过程的实现,过程没有问题,plsql调试正常!!! 现在我可以确定问题在 1.ibatis xml文件中jdbcType 和typeHandler的配置问题 1 <parameter property="PRM_OBJECTS" javaType="java.sql.ResultSet" 2 5 jdbcType="ARRAY" mode="OUT" typeHandler="com.diy.object.entity.ObjectTypeHandler" /> 3 6 <parameter property="PRM_TAGS" javaType="java.sql.ResultSet" 4 7 jdbcType="ARRAY" mode="OUT" typeHandler="com.diy.tag.entity.TagsTypeHandler" /> 2.java typeHandler类的返回值 还有一个附带的问题:index by 表不能在数据库中存储,而嵌套表可以存储在数据库中。是不是说index by 表 像java 方法中声明的变量,方法结束,其变量的生命周期就结束了??? 谢谢!!!

如何将值从javascript传递到PHP,然后作为整数传递给oracle数据库

<div class="post-text" itemprop="text"> <p>Hi I have a problem passing values from javascript to PHP(in a separate file) </p> <pre><code>function checked(){ var length = document.getElementById("Options").length; alert(length); for(var i = 0; i &lt; length - 1; i++){ if(document.getElementById(i).checked){ var selectedId = i; var slecetedValue = document.getElementById(i).value; } } } </code></pre> <p>These are the variables calculated in the javascript function. But I need to pass them to a seperate php file to send them to an ORACLE database (hopefully as integers). How exactly can I fix this problem? </p> <p>Also, how exactly can I send a an integer to an oracle database cause oci_by_name normally sends a varchar but I need a Number. </p> <p>PS. I know there are examples online but I don't really understand could you give me an example ? </p> <p>Thanks you</p> </div>

在Oracle PL/SQL中创建数据包,遇到报错:PLS-00103:出现符号“CREATE”,请问如何解决?

本人小白,我在创建基于存储过程的数据块时,第一次按照网上的教程,依葫芦画样创建成功后,运行也成功,但是手贱没有保存,也因为脑残有点飘,第二次自己创建时出现问题,后续把第一次成功做的样例拿出来再对照编写时,不断报错,最后重新把第一次做的样例拿出来已经无法运行,所以来此请教各位大佬。 先把我参考的网址挂出来:https://blog.csdn.net/weixin_33915554/article/details/85448269 接下来,我说一下问题: 我在Oracle的PL/SQL Developer中创建了一个Package: hek_ar_reciept_pg 包中代码贴出来如下: ``` create or replace package hek_ar_reciept_pg is type line_record_type is record( LINE_ID NUMBER, HEADER_ID NUMBER, CUSTOMER_TRX_ID NUMBER, APPLY_ACCOUNT NUMBER, APPLY_DATE DATE, GL_DATE DATE, DISCOUNT NUMBER, REVERSAL_GL_DATE DATE, AMOUNT_APPLIED_FROM NUMBER, MATCH_FLAG VARCHAR2(30), APPLY_FLAG VARCHAR2(10), TRX_NUMBER VARCHAR2(30), INSTALLMENT NUMBER, AMOUNT_DUE_REMAINING NUMBER, INVOICE_CURRENCY_CODE VARCHAR2(15), CUSTOMER_NUMBER VARCHAR2(30), CUSTOMER_ID NUMBER, CUSTOMER_NAME VARCHAR2(50), TRX_CLASS_NAME VARCHAR2(4000), TRX_CLASS_CODE VARCHAR2(20), TRX_TYPE_NAME VARCHAR2(20), PURCHASE_ORDER VARCHAR2(50), CT_REFERENCE VARCHAR2(30), LOCATION_NAME VARCHAR2(40), BILL_TO_SITE_USE_ID NUMBER, STATUS VARCHAR2(30), CASH_RECEIPT_ID NUMBER, PS_CUSTOMER_TRX_ID NUMBER, TRX_BATCH_SOURCE_NAME VARCHAR2(50), DUE_DATE DATE, TERM_ID NUMBER, CUST_TRX_TYPE_ID NUMBER, PROGRAM_APPLICATION_ID NUMBER, PROGRAM_ID NUMBER, REQUEST_ID NUMBER, AMOUNT_DUE_ORIGINAL NUMBER, AMOUNT_IN_DISPUTE NUMBER, AMOUNT_LINE_ITEMS_ORIGINAL NUMBER, ACCTD_AMOUNT_DUE_REMAINING NUMBER, TRX_DATE DATE, APPLIED_PAYMENT_SCHEDULE_ID NUMBER, CREATED_BY NUMBER, CREATION_DATE DATE, LAST_UPDATED_BY NUMBER, LAST_UPDATE_DATE DATE, LAST_UPDATE_LOGIN NUMBER, ORG_ID NUMBER, ATTRIBUTE_CATEGORY VARCHAR2(30), ATTRIBUTE1 VARCHAR2(50), ATTRIBUTE2 VARCHAR2(50), ATTRIBUTE3 VARCHAR2(50), ATTRIBUTE4 VARCHAR2(50), ATTRIBUTE5 VARCHAR2(50), ATTRIBUTE6 VARCHAR2(50), ATTRIBUTE7 VARCHAR2(50), ATTRIBUTE8 VARCHAR2(50), ATTRIBUTE9 VARCHAR2(50), ATTRIBUTE10 VARCHAR2(50), ATTRIBUTE11 VARCHAR2(150), ATTRIBUTE12 VARCHAR2(150), ATTRIBUTE13 VARCHAR2(150), ATTRIBUTE14 VARCHAR2(150), ATTRIBUTE15 VARCHAR2(150) ); type lines_record_type is record( LINE_ID NUMBER, HEADER_ID NUMBER, CUSTOMER_TRX_ID NUMBER, APPLY_ACCOUNT NUMBER, APPLY_DATE DATE, GL_DATE DATE, DISCOUNT NUMBER, REVERSAL_GL_DATE DATE, AMOUNT_APPLIED_FROM NUMBER, MATCH_FLAG VARCHAR2(30), APPLY_FLAG VARCHAR2(10), CREATED_BY NUMBER, CREATION_DATE DATE, LAST_UPDATED_BY NUMBER, LAST_UPDATE_DATE DATE, LAST_UPDATE_LOGIN NUMBER, ORG_ID NUMBER, ATTRIBUTE_CATEGORY VARCHAR2(30), ATTRIBUTE1 VARCHAR2(50), ATTRIBUTE2 VARCHAR2(50), ATTRIBUTE3 VARCHAR2(50), ATTRIBUTE4 VARCHAR2(50), ATTRIBUTE5 VARCHAR2(50), ATTRIBUTE6 VARCHAR2(50), ATTRIBUTE7 VARCHAR2(50), ATTRIBUTE8 VARCHAR2(50), ATTRIBUTE9 VARCHAR2(50), ATTRIBUTE10 VARCHAR2(50), ATTRIBUTE11 VARCHAR2(150), ATTRIBUTE12 VARCHAR2(150), ATTRIBUTE13 VARCHAR2(150), ATTRIBUTE14 VARCHAR2(150), ATTRIBUTE15 VARCHAR2(150) ); type line_ref_cursor is ref cursor return line_record_type; type line_table_type is table of lines_record_type index by binary_integer; procedure line_query(dmlset in out line_ref_cursor); procedure line_lock(dmlset in out line_table_type); procedure line_insert(dmlset in out line_table_type); procedure line_update(dmlset in out line_table_type); procedure line_delete(dmlset in out line_table_type); end; create or replace package body hek_ar_reciept_pg is procedure line_query(dmlset in out line_ref_cursor) is begin open dmlset for select line_id, header_id, customer_trx_id, apply_account, apply_date, gl_date, discount, reversal_gl_date, amount_applied_from, match_flag, apply_flag, trx_number, installment, amount_due_remaining, invoice_currency_code, customer_number, customer_id, customer_name, trx_class_name, trx_class_code, trx_type_name, purchase_order, ct_reference, location_name, bill_to_site_use_id, status, cash_receipt_id, ps_customer_trx_id, trx_batch_source_name, due_date, term_id, cust_trx_type_id, program_application_id, program_id, request_id, amount_due_original, amount_in_dispute, amount_line_items_original, acctd_amount_due_remaining, trx_date, applied_payment_schedule_id, created_by, creation_date, last_updated_by, last_update_date, last_update_login, org_id, attribute_category, attribute1, attribute2, attribute3, attribute4, attribute5, attribute6, attribute7, attribute8, attribute9, attribute10, attribute11, attribute12, attribute13, attribute14, attribute15 from hek_ar_reciept_lines_v; end; procedure line_lock(dmlset in out line_table_type) is l_line_id number; begin select line_id into l_line_id from hek_ar_reciept_lines_all where line_id = dmlset(1).line_id for update; end; procedure line_insert(dmlset in out line_table_type) is begin insert into hek_ar_reciept_lines_all(LINE_ID, HEADER_ID, CUSTOMER_TRX_ID, APPLY_ACCOUNT, APPLY_DATE, GL_DATE, DISCOUNT, REVERSAL_GL_DATE, AMOUNT_APPLIED_FROM, MATCH_FLAG, APPLY_FLAG, CREATED_BY, CREATION_DATE, LAST_UPDATED_BY, LAST_UPDATE_DATE, LAST_UPDATE_LOGIN, ORG_ID, ATTRIBUTE_CATEGORY, ATTRIBUTE1, ATTRIBUTE2, ATTRIBUTE3, ATTRIBUTE4, ATTRIBUTE5, ATTRIBUTE6, ATTRIBUTE7, ATTRIBUTE8, ATTRIBUTE9, ATTRIBUTE10, ATTRIBUTE11, ATTRIBUTE12, ATTRIBUTE13, ATTRIBUTE14, ATTRIBUTE15) values(dmlset(1).LINE_ID, dmlset(1).HEADER_ID, dmlset(1).CUSTOMER_TRX_ID, dmlset(1).APPLY_ACCOUNT, dmlset(1).APPLY_DATE, dmlset(1).GL_DATE, dmlset(1).DISCOUNT, dmlset(1).REVERSAL_GL_DATE, dmlset(1).AMOUNT_APPLIED_FROM, dmlset(1).MATCH_FLAG, dmlset(1).APPLY_FLAG, dmlset(1).CREATED_BY, dmlset(1).CREATION_DATE, dmlset(1).LAST_UPDATED_BY, dmlset(1).LAST_UPDATE_DATE, dmlset(1).LAST_UPDATE_LOGIN, dmlset(1).ORG_ID, dmlset(1).ATTRIBUTE_CATEGORY, dmlset(1).ATTRIBUTE1, dmlset(1).ATTRIBUTE2, dmlset(1).ATTRIBUTE3, dmlset(1).ATTRIBUTE4, dmlset(1).ATTRIBUTE5, dmlset(1).ATTRIBUTE6, dmlset(1).ATTRIBUTE7, dmlset(1).ATTRIBUTE8, dmlset(1).ATTRIBUTE9, dmlset(1).ATTRIBUTE10, dmlset(1).ATTRIBUTE11, dmlset(1).ATTRIBUTE12, dmlset(1).ATTRIBUTE13, dmlset(1).ATTRIBUTE14, dmlset(1).ATTRIBUTE15); end; procedure line_update(dmlset in out line_table_type) is begin update hek_ar_reciept_lines_all set HEADER_ID = dmlset(1).HEADER_ID,--LINE_ID = dmlset(1).LINE_ID, CUSTOMER_TRX_ID = dmlset(1).CUSTOMER_TRX_ID, APPLY_ACCOUNT = dmlset(1).APPLY_ACCOUNT, APPLY_DATE = dmlset(1).APPLY_DATE, GL_DATE = dmlset(1).GL_DATE, DISCOUNT = dmlset(1).DISCOUNT, REVERSAL_GL_DATE = dmlset(1).REVERSAL_GL_DATE, AMOUNT_APPLIED_FROM = dmlset(1).AMOUNT_APPLIED_FROM, MATCH_FLAG = dmlset(1).MATCH_FLAG, APPLY_FLAG = dmlset(1).APPLY_FLAG, CREATED_BY = dmlset(1).CREATED_BY, CREATION_DATE = dmlset(1).CREATION_DATE, LAST_UPDATED_BY = dmlset(1).LAST_UPDATED_BY, LAST_UPDATE_DATE = dmlset(1).LAST_UPDATE_DATE, LAST_UPDATE_LOGIN = dmlset(1).LAST_UPDATE_LOGIN, ORG_ID = dmlset(1).ORG_ID, ATTRIBUTE_CATEGORY = dmlset(1).ATTRIBUTE_CATEGORY, ATTRIBUTE1 = dmlset(1).ATTRIBUTE1, ATTRIBUTE2 = dmlset(1).ATTRIBUTE2, ATTRIBUTE3 = dmlset(1).ATTRIBUTE3, ATTRIBUTE4 = dmlset(1).ATTRIBUTE4, ATTRIBUTE5 = dmlset(1).ATTRIBUTE5, ATTRIBUTE6 = dmlset(1).ATTRIBUTE6, ATTRIBUTE7 = dmlset(1).ATTRIBUTE7, ATTRIBUTE8 = dmlset(1).ATTRIBUTE8, ATTRIBUTE9 = dmlset(1).ATTRIBUTE9, ATTRIBUTE10 = dmlset(1).ATTRIBUTE10, ATTRIBUTE11 = dmlset(1).ATTRIBUTE11, ATTRIBUTE12 = dmlset(1).ATTRIBUTE12, ATTRIBUTE13 = dmlset(1).ATTRIBUTE13, ATTRIBUTE14 = dmlset(1).ATTRIBUTE14, ATTRIBUTE15 = dmlset(1).ATTRIBUTE15 where line_id = dmlset(1).line_id; end; procedure line_delete(dmlset in out line_table_type) is begin delete from hek_ar_reciept_lines_all where line_id = dmlset(1).line_id; end; end; ``` 但是执行后,代码第118行出现报错 118:create or replace package body hek_ar_reciept_pg is 错误为:118 PLS-00103:出现符号“CREATE” ![图片说明](https://img-ask.csdn.net/upload/202002/26/1582688274_946360.png) (这里代码行数118是我现在电脑上的行数,对照截图可能有一两行空白行的出入) 针对这个错误,我看了好多帖子,但是始终有错,后来,我觉得饭一口一口吃,从第118行开始全部删掉,只留下上面line_record_type记录部分,后成功运行,无报错, ![图片说明](https://img-ask.csdn.net/upload/202002/26/1582688736_196739.png) 但是,这个时候,我在Oracle Forms builder中创建数据库向导的时候,发现在输入过程的时候,我输入:hek_ar_reciept_pg.line_query或hek_ar_reciept_pg.line_record,刷新的时候,发现报错 FRM-10760:描述存储过程时遇到错误, ![图片说明](https://img-ask.csdn.net/upload/202002/26/1582688651_407224.png) 最后重新把第一次做的样例拿出来已经无法运行,所以来此请教各位大佬。 先把我参考的网址挂出来:https://blog.csdn.net/weixin_33915554/article/details/85448269 接下来,我说一下问题: 我在Oracle的PL/SQL Developer中创建了一个Package: hek_ar_reciept_pg 包中代码贴出来如下: ``` create or replace package hek_ar_reciept_pg is type line_record_type is record( LINE_ID NUMBER, HEADER_ID NUMBER, CUSTOMER_TRX_ID NUMBER, APPLY_ACCOUNT NUMBER, APPLY_DATE DATE, GL_DATE DATE, DISCOUNT NUMBER, REVERSAL_GL_DATE DATE, AMOUNT_APPLIED_FROM NUMBER, MATCH_FLAG VARCHAR2(30), APPLY_FLAG VARCHAR2(10), TRX_NUMBER VARCHAR2(30), INSTALLMENT NUMBER, AMOUNT_DUE_REMAINING NUMBER, INVOICE_CURRENCY_CODE VARCHAR2(15), CUSTOMER_NUMBER VARCHAR2(30), CUSTOMER_ID NUMBER, CUSTOMER_NAME VARCHAR2(50), TRX_CLASS_NAME VARCHAR2(4000), TRX_CLASS_CODE VARCHAR2(20), TRX_TYPE_NAME VARCHAR2(20), PURCHASE_ORDER VARCHAR2(50), CT_REFERENCE VARCHAR2(30), LOCATION_NAME VARCHAR2(40), BILL_TO_SITE_USE_ID NUMBER, STATUS VARCHAR2(30), CASH_RECEIPT_ID NUMBER, PS_CUSTOMER_TRX_ID NUMBER, TRX_BATCH_SOURCE_NAME VARCHAR2(50), DUE_DATE DATE, TERM_ID NUMBER, CUST_TRX_TYPE_ID NUMBER, PROGRAM_APPLICATION_ID NUMBER, PROGRAM_ID NUMBER, REQUEST_ID NUMBER, AMOUNT_DUE_ORIGINAL NUMBER, AMOUNT_IN_DISPUTE NUMBER, AMOUNT_LINE_ITEMS_ORIGINAL NUMBER, ACCTD_AMOUNT_DUE_REMAINING NUMBER, TRX_DATE DATE, APPLIED_PAYMENT_SCHEDULE_ID NUMBER, CREATED_BY NUMBER, CREATION_DATE DATE, LAST_UPDATED_BY NUMBER, LAST_UPDATE_DATE DATE, LAST_UPDATE_LOGIN NUMBER, ORG_ID NUMBER, ATTRIBUTE_CATEGORY VARCHAR2(30), ATTRIBUTE1 VARCHAR2(50), ATTRIBUTE2 VARCHAR2(50), ATTRIBUTE3 VARCHAR2(50), ATTRIBUTE4 VARCHAR2(50), ATTRIBUTE5 VARCHAR2(50), ATTRIBUTE6 VARCHAR2(50), ATTRIBUTE7 VARCHAR2(50), ATTRIBUTE8 VARCHAR2(50), ATTRIBUTE9 VARCHAR2(50), ATTRIBUTE10 VARCHAR2(50), ATTRIBUTE11 VARCHAR2(150), ATTRIBUTE12 VARCHAR2(150), ATTRIBUTE13 VARCHAR2(150), ATTRIBUTE14 VARCHAR2(150), ATTRIBUTE15 VARCHAR2(150) ); type lines_record_type is record( LINE_ID NUMBER, HEADER_ID NUMBER, CUSTOMER_TRX_ID NUMBER, APPLY_ACCOUNT NUMBER, APPLY_DATE DATE, GL_DATE DATE, DISCOUNT NUMBER, REVERSAL_GL_DATE DATE, AMOUNT_APPLIED_FROM NUMBER, MATCH_FLAG VARCHAR2(30), APPLY_FLAG VARCHAR2(10), CREATED_BY NUMBER, CREATION_DATE DATE, LAST_UPDATED_BY NUMBER, LAST_UPDATE_DATE DATE, LAST_UPDATE_LOGIN NUMBER, ORG_ID NUMBER, ATTRIBUTE_CATEGORY VARCHAR2(30), ATTRIBUTE1 VARCHAR2(50), ATTRIBUTE2 VARCHAR2(50), ATTRIBUTE3 VARCHAR2(50), ATTRIBUTE4 VARCHAR2(50), ATTRIBUTE5 VARCHAR2(50), ATTRIBUTE6 VARCHAR2(50), ATTRIBUTE7 VARCHAR2(50), ATTRIBUTE8 VARCHAR2(50), ATTRIBUTE9 VARCHAR2(50), ATTRIBUTE10 VARCHAR2(50), ATTRIBUTE11 VARCHAR2(150), ATTRIBUTE12 VARCHAR2(150), ATTRIBUTE13 VARCHAR2(150), ATTRIBUTE14 VARCHAR2(150), ATTRIBUTE15 VARCHAR2(150) ); type line_ref_cursor is ref cursor return line_record_type; type line_table_type is table of lines_record_type index by binary_integer; procedure line_query(dmlset in out line_ref_cursor); procedure line_lock(dmlset in out line_table_type); procedure line_insert(dmlset in out line_table_type); procedure line_update(dmlset in out line_table_type); procedure line_delete(dmlset in out line_table_type); end; create or replace package body hek_ar_reciept_pg is procedure line_query(dmlset in out line_ref_cursor) is begin open dmlset for select line_id, header_id, customer_trx_id, apply_account, apply_date, gl_date, discount, reversal_gl_date, amount_applied_from, match_flag, apply_flag, trx_number, installment, amount_due_remaining, invoice_currency_code, customer_number, customer_id, customer_name, trx_class_name, trx_class_code, trx_type_name, purchase_order, ct_reference, location_name, bill_to_site_use_id, status, cash_receipt_id, ps_customer_trx_id, trx_batch_source_name, due_date, term_id, cust_trx_type_id, program_application_id, program_id, request_id, amount_due_original, amount_in_dispute, amount_line_items_original, acctd_amount_due_remaining, trx_date, applied_payment_schedule_id, created_by, creation_date, last_updated_by, last_update_date, last_update_login, org_id, attribute_category, attribute1, attribute2, attribute3, attribute4, attribute5, attribute6, attribute7, attribute8, attribute9, attribute10, attribute11, attribute12, attribute13, attribute14, attribute15 from hek_ar_reciept_lines_v; end; procedure line_lock(dmlset in out line_table_type) is l_line_id number; begin select line_id into l_line_id from hek_ar_reciept_lines_all where line_id = dmlset(1).line_id for update; end; procedure line_insert(dmlset in out line_table_type) is begin insert into hek_ar_reciept_lines_all(LINE_ID, HEADER_ID, CUSTOMER_TRX_ID, APPLY_ACCOUNT, APPLY_DATE, GL_DATE, DISCOUNT, REVERSAL_GL_DATE, AMOUNT_APPLIED_FROM, MATCH_FLAG, APPLY_FLAG, CREATED_BY, CREATION_DATE, LAST_UPDATED_BY, LAST_UPDATE_DATE, LAST_UPDATE_LOGIN, ORG_ID, ATTRIBUTE_CATEGORY, ATTRIBUTE1, ATTRIBUTE2, ATTRIBUTE3, ATTRIBUTE4, ATTRIBUTE5, ATTRIBUTE6, ATTRIBUTE7, ATTRIBUTE8, ATTRIBUTE9, ATTRIBUTE10, ATTRIBUTE11, ATTRIBUTE12, ATTRIBUTE13, ATTRIBUTE14, ATTRIBUTE15) values(dmlset(1).LINE_ID, dmlset(1).HEADER_ID, dmlset(1).CUSTOMER_TRX_ID, dmlset(1).APPLY_ACCOUNT, dmlset(1).APPLY_DATE, dmlset(1).GL_DATE, dmlset(1).DISCOUNT, dmlset(1).REVERSAL_GL_DATE, dmlset(1).AMOUNT_APPLIED_FROM, dmlset(1).MATCH_FLAG, dmlset(1).APPLY_FLAG, dmlset(1).CREATED_BY, dmlset(1).CREATION_DATE, dmlset(1).LAST_UPDATED_BY, dmlset(1).LAST_UPDATE_DATE, dmlset(1).LAST_UPDATE_LOGIN, dmlset(1).ORG_ID, dmlset(1).ATTRIBUTE_CATEGORY, dmlset(1).ATTRIBUTE1, dmlset(1).ATTRIBUTE2, dmlset(1).ATTRIBUTE3, dmlset(1).ATTRIBUTE4, dmlset(1).ATTRIBUTE5, dmlset(1).ATTRIBUTE6, dmlset(1).ATTRIBUTE7, dmlset(1).ATTRIBUTE8, dmlset(1).ATTRIBUTE9, dmlset(1).ATTRIBUTE10, dmlset(1).ATTRIBUTE11, dmlset(1).ATTRIBUTE12, dmlset(1).ATTRIBUTE13, dmlset(1).ATTRIBUTE14, dmlset(1).ATTRIBUTE15); end; procedure line_update(dmlset in out line_table_type) is begin update hek_ar_reciept_lines_all set HEADER_ID = dmlset(1).HEADER_ID,--LINE_ID = dmlset(1).LINE_ID, CUSTOMER_TRX_ID = dmlset(1).CUSTOMER_TRX_ID, APPLY_ACCOUNT = dmlset(1).APPLY_ACCOUNT, APPLY_DATE = dmlset(1).APPLY_DATE, GL_DATE = dmlset(1).GL_DATE, DISCOUNT = dmlset(1).DISCOUNT, REVERSAL_GL_DATE = dmlset(1).REVERSAL_GL_DATE, AMOUNT_APPLIED_FROM = dmlset(1).AMOUNT_APPLIED_FROM, MATCH_FLAG = dmlset(1).MATCH_FLAG, APPLY_FLAG = dmlset(1).APPLY_FLAG, CREATED_BY = dmlset(1).CREATED_BY, CREATION_DATE = dmlset(1).CREATION_DATE, LAST_UPDATED_BY = dmlset(1).LAST_UPDATED_BY, LAST_UPDATE_DATE = dmlset(1).LAST_UPDATE_DATE, LAST_UPDATE_LOGIN = dmlset(1).LAST_UPDATE_LOGIN, ORG_ID = dmlset(1).ORG_ID, ATTRIBUTE_CATEGORY = dmlset(1).ATTRIBUTE_CATEGORY, ATTRIBUTE1 = dmlset(1).ATTRIBUTE1, ATTRIBUTE2 = dmlset(1).ATTRIBUTE2, ATTRIBUTE3 = dmlset(1).ATTRIBUTE3, ATTRIBUTE4 = dmlset(1).ATTRIBUTE4, ATTRIBUTE5 = dmlset(1).ATTRIBUTE5, ATTRIBUTE6 = dmlset(1).ATTRIBUTE6, ATTRIBUTE7 = dmlset(1).ATTRIBUTE7, ATTRIBUTE8 = dmlset(1).ATTRIBUTE8, ATTRIBUTE9 = dmlset(1).ATTRIBUTE9, ATTRIBUTE10 = dmlset(1).ATTRIBUTE10, ATTRIBUTE11 = dmlset(1).ATTRIBUTE11, ATTRIBUTE12 = dmlset(1).ATTRIBUTE12, ATTRIBUTE13 = dmlset(1).ATTRIBUTE13, ATTRIBUTE14 = dmlset(1).ATTRIBUTE14, ATTRIBUTE15 = dmlset(1).ATTRIBUTE15 where line_id = dmlset(1).line_id; end; procedure line_delete(dmlset in out line_table_type) is begin delete from hek_ar_reciept_lines_all where line_id = dmlset(1).line_id; end; end; ``` 但是执行后,代码第118行出现报错 118:create or replace package body hek_ar_reciept_pg is 错误为:118 PLS-00103:出现符号“CREATE” ![图片说明](https://img-ask.csdn.net/upload/202002/26/1582688274_946360.png) (这里代码行数118是我现在电脑上的行数,对照截图可能有一两行空白行的出入) 针对这个错误,我看了好多帖子,但是始终有错,后来,我觉得饭一口一口吃,从第118行开始全部删掉,只留下上面line_record_type记录部分,后成功运行,无报错, ![图片说明](https://img-ask.csdn.net/upload/202002/26/1582688736_196739.png) 但是,这个时候,我在Oracle Forms builder中创建数据库向导的时候,发现在输入过程的时候,我输入:hek_ar_reciept_pg.line_query或hek_ar_reciept_pg.line_record,刷新的时候,发现报错 FRM-10760:描述存储过程时遇到错误, ![图片说明](https://img-ask.csdn.net/upload/202002/26/1582688651_407224.png) 接下来始终卡在这里,进退不得,一方面无法进行数据块的创建,另一方面在Oracle PL/SQL developer中也没什么好办法继续下去,麻烦各位大佬讲解一下,指导一二,感激不尽! ************************************************************************* 以上是第一次的问题,后面听取了各位意见后,我通过重建数据库,初步实现了目的,但是实际上,还是有些问题的,比如:我在数据库编写数据包时,遇到如下问题: ![图片说明](https://img-ask.csdn.net/upload/202002/27/1582783658_704931.png) ![图片说明](https://img-ask.csdn.net/upload/202002/27/1582783670_232284.png) 虽然依旧能跑,但是毫无疑问,功能是有问题的 如下: ![图片说明](https://img-ask.csdn.net/upload/202002/27/1582783723_927212.png) ![图片说明](https://img-ask.csdn.net/upload/202002/27/1582783977_229683.png) 请问,在PL/SQL中的数据包中,怎么修改才能解决这个问题?请求指点,谢谢!

无法使dbms_output在PHP中工作(连接到Oracle数据库)

<div class="post-text" itemprop="text"> <p><strong>EDIT// Problem solved</strong> - I have re-written my code into a PL/SQL package and function, so I can now simply call this using a standard select statement. I will leave my original query below and a couple of links I found useful for anyone in a similar position.</p> <p><em>Links</em></p> <ul> <li><a href="http://www.plsql-tutorial.com/plsql-functions.htm" rel="nofollow noreferrer">http://www.plsql-tutorial.com/plsql-functions.htm</a></li> <li><a href="https://stackoverflow.com/questions/11291693/creating-and-calling-pl-sql-functions">Creating and calling PL/SQL functions</a></li> <li><a href="http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.apdv.plsql.doc%2Fdoc%2Fr0054067.html" rel="nofollow noreferrer">http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.apdv.plsql.doc%2Fdoc%2Fr0054067.html</a></li> </ul> <p><em>Original query</em></p> <p>I have been trying to a long long time to get my PHP code to successfully process my PL/SQL dbms_output. I cannot seem to get it to work. The rest of the code works, and in SQL developer I get the correct outputs. The error reporting works too as if I leave anything out of the code I get the errors reported (e.g. not caching the network). It is just not giving me my final output. Here is the dbms_output sections of my code in PHP.</p> <pre><code>// Fetch and display any dbms_output function DisplayDbmsOutput($con) { $r = GetDbmsOutput($con); if (!$r) print "&lt;p&gt;Error getting dbms_output&lt;/p&gt; "; else foreach ($r as $line) echo $line."&lt;br&gt; "; } // Returns an array of dbms_output lines, or false. function GetDbmsOutput($con) { $res = false; $stid = doParse($con, "BEGIN DBMS_OUTPUT.GET_LINE(:LN, :ST); END;"); if ($stid) { if (doBind($stid, ":LN", $ln, 255) &amp;&amp; doBind($stid, ":ST", $st, "")) { $res = array(); while ($succ = doExecute($stid)) { if ($st) break; $res[] = $ln; } if (!$succ) $res = false; } @OCIFreeStatement($stid); } return ($res); } // Cache Network CacheNetwork($con, true); // turn serveroutput on SetServerOutput($con, true); // Create dbms_output $s = doParse($con, " DECLARE cost NUMBER; path_id NUMBER; res_numeric NUMBER; res_array SDO_NUMBER_ARRAY; Nav_Info Test_Turns.Navigation_Info%TYPE; Walk_Dist chadwick_link$.cost%TYPE; Starting_Node_ID chadwick_link$.Start_Node_ID%TYPE; Ending_Node_ID chadwick_link$.End_Node_ID%TYPE; start_node_id Number; goal_node_id Number; goal_node varchar(20); txtArray dbms_output.chararr; numLines integer := 4; BEGIN start_node_id := 34; goal_node_id := 19; goal_node := '%' || ' ' || (to_Char(goal_node_id)) || ',' || '%'; path_id := sdo_net_mem.network_manager.shortest_path('CHADWICK', start_node_id, goal_node_id); cost := SDO_NET_MEM.PATH.GET_COST('CHADWICK', path_id); res_array := SDO_NET_MEM.PATH.GET_LINK_IDS('CHADWICK', path_id); FOR indx IN res_array.FIRST..res_array.LAST LOOP Select Start_Node_ID INTO Starting_Node_ID from chadwick_link$ where Link_ID = res_array(indx); Select End_Node_ID INTO Ending_Node_ID from chadwick_link$ where Link_ID = res_array(indx); Select Navigation_Info INTO Nav_Info from Test_Turns_Two where Starting_Node = Starting_Node_ID and Finishing_Node = Ending_Node_ID and possible_finish_nodes Like goal_node; select cost INTO Walk_Dist from chadwick_link$ where link_id = res_array(indx); DBMS_OUTPUT.PUT(Nav_Info || ' ' || Walk_Dist || ' meters'); END LOOP; DBMS_OUTPUT.PUT('You have arrived at your destination'); DBMS_OUTPUT.PUT(' '); END; "); if ($s) doExecute($s); // Display the output DisplayDbmsOutput($con); </code></pre> <p>Any suggestions would be wonderful!</p> </div>

急 Oracle ORA-00904 标识符无效问题

用的是 Oracle Database 10g Release 2 (10.2.0.1.0) 在执行插入的时候报错:java.sql.SQLException: ORA-00904: "ICOUT": 标识符无效。 但表中的确有这个字段。把SQL语句复制到PL/SQL Dev中就可以正常执行。弄了一天了,驱动也换过,语句也改过,但就是不行。那位大侠遇到过这个问题啊。 表结构: -- User Journal CREATE TABLE ic_journal ( icuid INTEGER REFERENCES ic_users (id), -- user UID icin NUMBER(19,0), -- UNIX time (UTC) when user came in session icout NUMBER(19,0) NOT NULL, -- UNIX time (UTC) when user get out session PRIMARY KEY (icuid, icin) ); 代码: String sql = "INSERT INTO ic_journal (icuid, icin, icout) VALUES (0, 1280977470671, 1280977470671)"; Statement st = conn.createStatement(); [b]st.executeUpdate(sql); [/b]// 报错

Oracle在给表中字段添加GENERATED BY DEFAULT AS IDENTITY(start with 1,increment by 1)时出现缺失右括号 00907. 00000 - "missing right parenthesis"错误

CREATE TABLE employees ( lastName VARCHAR2(50) NOT NULL, employeeNumber NUMBER(11) NOT NULL GENERATED BY DEFAULT AS IDENTITY(start with 1,increment by 1) UNIQUE, firstName varchar2(50) NOT NULL, mobile VARCHAR(25) UNIQUE, officeCode VARCHAR2(10) NOT NULL, jobTitle VARCHAR2(50) NOT NULL, birth DATE NOT NULL, note VARCHAR2(255), gender VARCHAR2(5), CONSTRAINT fk_employees_officeCode FOREIGN KEY(officeCode) REFERENCES office(officeCode) ); ![图片说明](https://img-ask.csdn.net/upload/202005/21/1590037701_238951.png)

Cattle

Description A group of more or less domesticated bovine animals (hereafter to be referred to as cattle) are to be loaded into railway freight cars of certain train. The train consists of K freight cars (and a locomotive, which is kind of irrelevant to this problem), which can be loaded with at most M animals each. A number from 1 to N is painted on each animal (all numbers are used and no two animals carries the same number so by easy induction on N one concludes that there are exactly N animals). The animals are patiently waiting to be loaded in a queue sorted by their numbers in ascending order (1 is the first to be loaded etc.). One freight car is loaded at a time by arbitrary number of animals (not exceeding M, of course) from the beginning of the queue and then locked so no subsequent load of animals to that freight car is possible. The process of loading is continued until all freight cars are locked. It is known that some clashing pairs of animals dislikes each other and if loaded in the same freight car then the stronger one will attempt to kill the other. It is also known that there are friendly pairs of animals where the stronger animal will always successfully protect the weaker one from attack of any other animal. If no alive friendly protecting animal is present, the attack of stronger animal of a clashing pair is always successfull. All attacks in a freight car starts when it is locked. The transportation lasts long enough for all attacks to finish. Write a program that will suggest the loading of animals to the freight cars so that the number of alive animals at the end of transportation will be as large as possible. Input The first line of the input contains three integers N, K, M; 1 <= N,K <= 1000, 1 <= M <= 20. The second line contains integer D – the number of clashing pairs among the animals. Each of the following D lines contains three mutually different integers A, B, C. The pair (A, B) represents a clashing pair, and the pair (C, B) represents a friendly pair of animals. The second animal in each pair is always the weaker one. A stronger animal of a clashing pair cannot be a weaker animal in any other pair (the first number A cannot occur as a second number anywhere). A weaker animal of a clashing pair has exactly one friendly protecting animal (the third number C is uniquely determined by the first two numbers A and B). Output The first and only line of the output consists of an integer – the maximal number of alive animals at the end of transportation. Sample Input 5 2 3 2 1 2 3 1 3 2 Sample Output 5

关于在oracle的function中动态创建表结构的问题~~~

create or replace function jfids.sys_createobjectcopy ( puser in varchar2, --用户或schama ptype in varchar2, --对象类型=table,view,function,...etc pobjectname in varchar2, --对象名称 pdestuser in varchar2 --目标用户或schama ) return number is /****************************************************************************** NAME: sys_createobjectcopy PURPOSE: 根据已知的对象创建对象副本(从一个表空间到另一个表空间) REVISIONS: Ver Date Author Description --------- ---------- --------------- ------------------------------------ 1.0 2012/3/15 showgo 1. Created this function. NOTES: Automatically available Auto Replace Keywords: Object Name: sys_createobjectcopy Sysdate: 2012/3/15 Date and Time: 2012/3/15, 16:28:23, and 2012/3/15 16:28:23 Username: showgo (set in TOAD Options, Procedure Editor) Table Name: (set in the "New PL/SQL Object" dialog) ******************************************************************************/ --vars retcode integer; vcursor integer; vcnt integer; --clob to varchar2 array vscript clob; vscriptblob blob; vtmpblob blob; loblen integer; buffer integer := 4000; vsql varchar2 (32767 byte); vtmp varchar2 (4000 byte); --call convert blob param dest_offset integer; src_offset integer; lang_ctx integer := dbms_lob.default_lang_ctx; warning integer; --exception script_overlength_exception exception; begin retcode := 0; /* * 参数验证 */ if (puser is null or puser = '') then return 0; end if; if (pdestuser is null or pdestuser = '') then return 0; end if; if (ptype is null or ptype = '') then return 0; end if; if (pobjectname is null or pobjectname = '') then return 0; end if; /* * 取得对象的脚本的字符串(脚本可能很长,故先截取再组装) */ begin vscript := dbms_metadata.get_ddl (ptype, pobjectname, puser); /* vscript := replace (vscript, upper (puser), upper (pdestuser)); dbms_lob.converttoblob (vscriptblob, vscript, dbms_lob.lobmaxsize, dest_offset, src_offset, dbms_lob.default_csid, lang_ctx, warning); */ vscriptblob := sys_clob2blob (vscript); loblen := dbms_lob.getlength (vscriptblob); if (loblen > 0) then vcnt := ceil (loblen / buffer); vsql := ''; for i in 1 .. vcnt loop loblen := dbms_lob.getlength (vscriptblob); if (loblen <= buffer) then buffer := loblen; end if; vtmpblob := dbms_lob.substr (vscriptblob, buffer, 1); vtmp := utl_raw.cast_to_varchar2(utl_raw.convert ( vtmpblob, 'simplified chinese_china.zhs16gbk', 'simplified chinese_china.zhs16gbk')); vscriptblob := dbms_lob.substr (vscriptblob, loblen - buffer, buffer + 1); vsql := vsql || vtmp; end loop; else return 0; end if; /* * 按照脚本创建对象 * 创建之前,需要将原对象中用户(或schama)和表空间替换成新的用户(或schama)和表空间 * 注意: 默认用户及表空间使用的是同一名称. */ --vsql := trim (replace (vsql, puser, pdestuser)); --vcursor := dbms_sql.open_cursor; --dbms_sql.parse (dbms_sql.open_cursor, vsql, dbms_sql.native); --dbms_sql.close_cursor (vcursor); --vsql := TRIM (REPLACE (vsql, puser, pdestuser)); vsql := 'create table ''saas_98304''.tc_sex1(code varchar2(2),text varchar2(8),memo varchar2(80))'; execute immediate vsql; exception when no_data_found then retcode := 0; rollback; when others then retcode := 0; rollback; end; return retcode; exception when no_data_found then retcode := 0; rollback; when others then -- Consider logging the error and then re-raise retcode := 0; rollback; raise; end sys_createobjectcopy; / 类似以上的代码在function中。 背景:此function为用户JFIDS的对象,执行时要求能将用户JFIDS下的某些对象(比如表tc_sex)创建到另一用户saas_98304下。红色字体处为另一函数,未给出(其作用是将一个clob值转换成blob值),绿色字体处是一段测试代码,意思就是运行完后希望能得到在saas_98304用户下一个表tc_sex。貌似在pl/sql环境能正常执行,但是一旦写到function中就要报异常了,另外用户jfids已经有创建表结构的权限了。

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

Intellij IDEA 实用插件安利

1. 前言从2020 年 JVM 生态报告解读 可以看出Intellij IDEA 目前已经稳坐 Java IDE 头把交椅。而且统计得出付费用户已经超过了八成(国外统计)。IDEA 的...

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

魂迁光刻,梦绕芯片,中芯国际终获ASML大型光刻机

据羊城晚报报道,近日中芯国际从荷兰进口的一台大型光刻机,顺利通过深圳出口加工区场站两道闸口进入厂区,中芯国际发表公告称该光刻机并非此前盛传的EUV光刻机,主要用于企业复工复产后的生产线扩容。 我们知道EUV主要用于7nm及以下制程的芯片制造,光刻机作为集成电路制造中最关键的设备,对芯片制作工艺有着决定性的影响,被誉为“超精密制造技术皇冠上的明珠”,根据之前中芯国际的公报,目...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

百度工程师,获利10万,判刑3年!

所有一夜暴富的方法都写在刑法中,但总有人心存侥幸。这些年互联网犯罪高发,一些工程师高技术犯罪更是引发关注。这两天,一个百度运维工程师的案例传遍朋友圈。1...

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《Oracle Java SE编程自学与面试指南》最佳学习路线图2020年最新版(进大厂必备)

正确选择比瞎努力更重要!

字节跳动面试官竟然问了我JDBC?

轻松等回家通知

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

实时更新:计算机编程语言排行榜—TIOBE世界编程语言排行榜(2020年6月份最新版)

内容导航: 1、TIOBE排行榜 2、总榜(2020年6月份) 3、本月前三名 3.1、C 3.2、Java 3.3、Python 4、学习路线图 5、参考地址 1、TIOBE排行榜 TIOBE排行榜是根据全世界互联网上有经验的程序员、课程和第三方厂商的数量,并使用搜索引擎(如Google、Bing、Yahoo!)以及Wikipedia、Amazon、YouTube统计出排名数据。

立即提问
相关内容推荐