powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / PHP, Perl, Python [игнор отключен] [закрыт для гостей] / (PERL) DBD::Oracle + strored procedures
5 сообщений из 5, страница 1 из 1
(PERL) DBD::Oracle + strored procedures
    #33529463
Wireless
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Господа, подсажите как забрать OUT параметр из strored процедуры на оракле.
Нашел вот это http://www.orafaq.com/faqperl.htm#DBDPROC .

Но у моей ф-ии один OUT-параметр, как забрать его значение?
...
Рейтинг: 0 / 0
(PERL) DBD::Oracle + strored procedures
    #33529714
Фотография Black
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
куда забрать?

значение из процедуры, забрать нельзя, его можно записать в переменную, а потом для другого запроса ее использовать.

разъясните более подробно, что Вы хотите сделать.
...
Рейтинг: 0 / 0
(PERL) DBD::Oracle + strored procedures
    #33530134
Wireless
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
В общем решил.
see man DBD::Oracle.... :)
...
Рейтинг: 0 / 0
(PERL) DBD::Oracle + strored procedures
    #33530269
Фотография Black
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
так расскажите как решили, чтобы потом другие не спрашивали подобные вопросы ...
...
Рейтинг: 0 / 0
(PERL) DBD::Oracle + strored procedures
    #33530381
Wireless
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
вот три примера, думаю всем станет понятно по ним...

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
         # Example  1 
         #
         # Calling a PLSQL procedure that takes no parameters. This shows you the
         # basic's of what you need to execute a PLSQL procedure. Just wrap your
         # procedure call in a BEGIN END; block just like you'd do in SQL*Plus.
         #
         # p.s. If you've used SQL*Plus's exec command all it does is wrap the
         #      command in a BEGIN END; block for you.

         $csr = $db->prepare(q{
           BEGIN
             PLSQL_EXAMPLE.PROC_NP;
           END;
         });
         $csr->execute;

         # Example  2 
         #
         # Now we call a procedure that has  1  IN parameter. Here we use bind_param
         # to bind out parameter to the prepared statement just like you might
         # do for an INSERT, UPDATE, DELETE, or SELECT statement.
         #
         # I could have used positional placeholders (e.g. : 1 , : 2 , etc.) or
         # ODBC style placeholders (e.g. ?), but I prefer Oracle's named
         # placeholders (but few DBI drivers support them so they're not portable).

         my $err_code = - 20001 ;

         $csr = $db->prepare(q{
               BEGIN
                   PLSQL_EXAMPLE.PROC_IN(:err_code);
               END;
         });

         $csr->bind_param(":err_code", $err_code);

         # PROC_IN will RAISE_APPLICATION_ERROR which will cause the execute to 'fail'.
         # Because we set RaiseError, the DBI will croak (die) so we catch that with eval.
         eval {
           $csr->execute;
         };
         print 'After proc_in: $@=',"'$@', errstr=$DBI::errstr, ret_val=$ret_val\n";
         # Example  3 
         #
         # Building on the last example, I've added 1 IN OUT parameter. We still
         # use a placeholders in the call to prepare, the difference is that
         # we now call bind_param_inout to bind the value to the place holder.
         #
         # Note that the third parameter to bind_param_inout is the maximum size
         # of the variable. You normally make this slightly larger than necessary.
         # But note that the perl variable will have that much memory assigned to
         # it even if the actual value returned is shorter.

         my $test_num = 5;
         my $is_odd;

         $csr = $db->prepare(q{
               BEGIN
                   PLSQL_EXAMPLE.PROC_IN_INOUT(:test_num, :is_odd);
               END;
         });

         # The value of $test_num is _copied_ here
         $csr->bind_param(":test_num", $test_num);

         $csr->bind_param_inout(":is_odd", \$is_odd, 1);

         # The execute will automagically update the value of $is_odd
         $csr->execute;

         print "$test_num is ", ($is_odd) ? "odd - ok" : "even - error!", "\n";

         # Example 4
         #
         # What about the return value of a PLSQL function? Well treat it the same
         # as you would a call to a function from SQL*Plus. We add a placeholder
         # for the return value and bind it with a call to bind_param_inout so
         # we can access it's value after execute.

         my $whoami = "";

         $csr = $db->prepare(q{
               BEGIN
                   :whoami := PLSQL_EXAMPLE.FUNC_NP;
               END;
         });

         $csr->bind_param_inout(":whoami", \$whoami,  20 );
         $csr->execute;
         print "Your database user name is $whoami\n";

         $db->disconnect;

       You can find more examples in the t/plsql.t file in the DBD::Oracle
       source directory.

...
Рейтинг: 0 / 0
5 сообщений из 5, страница 1 из 1
Форумы / PHP, Perl, Python [игнор отключен] [закрыт для гостей] / (PERL) DBD::Oracle + strored procedures
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]